ASP.NET using C# - How to Connect/Retrieve in database to web a
Some people may be carrying out projects in ASP.NET and they may need help with connecting their database with ASP.NET. Likewise with retrieving in database to web application. A specific sequence must be followed with regards to the database and the retrieving process. Some programming knowledge is needed to able to carry out the steps. The answer below should provide the answers to the issues just mentioned.
Issue
I am doing my project work, and I have a problem. My project is in asp.net but I don't know how to connect the database in asp.net using c# and how to retrieve in database to web application.
Solution
Notice this line:
-> database. conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data source= @"path AccessFile.mdb";
It should be:
-> database. conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data source=AccessFile.mdb";
Other Connection String Sample.
Visual Basic] Public Sub CreateSqlConnection() Dim myConnection As New SqlConnection() myConnection.ConnectionString = "Persist Security Info=False;Integrated Security=SSPI;database=northwind;server=mySQLServer;Connect Timeout=30" myConnection.Open() End Sub 'CreateSqlConnection [C#] public void CreateSqlConnection() { SqlConnection myConnection = new SqlConnection(); myConnection.ConnectionString = "Persist Security Info=False;Integrated Security=SSPI;database=northwind;server=mySQLServer;Connect Timeout=30"; myConnection.Open(); } [C++] public: void CreateSqlConnection() { SqlConnection* myConnection = new SqlConnection(); myConnection->ConnectionString = S"Persist Security Info=False;Integrated Security=SSPI;database=northwind;server=mySQLServer;Connect Timeout=30"; myConnection->Open(); }
Note
Thanks to Wicket for this tip on the forum.
- ASP.NET using C# - How to Connect/Retrieve in database to web a
- How to connect microsoft access database to visual basic 6.0 pdf - Guide
- How to retrieve oracle database password - Guide
- Database error: unable to connect to the database:the mysql adapter "mysql" is not available. ✓ - Forum - Windows
- How do I fix a corrupted MS Access database? ✓ - Forum - Software
- How to connect to access database in c# - Forum - Programming