MilantoMinsk
Member
- Joined
- May 2, 2014
- Messages
- 7
- Programming Experience
- Beginner
I am using Visual Studio 2012 express and its SQL compact edition (CE) to make a database application. I did menage to add a database as a datasource, run a couple of SQL statements and displayed it in a DataGridView. However, I was relying on automatic database code and avoided to write any code, since I do not know it. But it seems it is inevitable. I got in trouble with the first line, as instructed on this link (Retrieving and Saving Data in Databases-VBForums).
The code is:
Using connection As New SqlConnection(Database1ConnectionString)
End Using
When I make a datasource, the Wizard gives me this as a connection string: ? Database1ConnectionString?. When I use it, i get error: ?Database1ConnectionString is not declared. It may be inaccessible due to its protection level.? I checked Project Designer (How to: Save and Edit Connection Strings) , but it all seems fine. Of course, I wrote at the beginning ?Imports System.Data.SqlClient?. I have saved the project and got written connectionstring to the config file. What am I doing wrong?
The code is:
Using connection As New SqlConnection(Database1ConnectionString)
End Using
When I make a datasource, the Wizard gives me this as a connection string: ? Database1ConnectionString?. When I use it, i get error: ?Database1ConnectionString is not declared. It may be inaccessible due to its protection level.? I checked Project Designer (How to: Save and Edit Connection Strings) , but it all seems fine. Of course, I wrote at the beginning ?Imports System.Data.SqlClient?. I have saved the project and got written connectionstring to the config file. What am I doing wrong?