-
Connecting Sql to Vb.net
If anyone could help me with this I would be very greatfull. I am new to vb.net and I am trying to get a combo box to read a field from my sql table. I am using my local server on my computer so I don't have a user name or password. All of the code that I have tried to use gives me a blue line underneath some of my statements saying it has not been declared. If someone could help me out I would be most greatfull!!!!!!!!!!!
-
imports system.data.sqlclient ???
-
Since you didn't post any code, it's pretty tough to say where it might be wrong.
-
This is what i used.
Dim myconnection as sqlconnection
Dim mycommand as sqlcommand
Dim myDatagrid as datagrid
I get blue lines underneath "myconnection, mycommand, and mydatagrid" saying that thier not declaired.
-
Dim myconnection as new sqlconnection
also with everyone else.
-
When I use the Dim myconnection as new sqlconnection the blue line is under sqlconnection saying that its not defined?
-
imports system.data.sqlclient
-
yeah but the imports has a blue line under it saying it must precede any declarations.
-
put it topmost
imports blah
public class
.
.
.
end class
-
-
I don't have a user name and password for my local sql, do I just leave that out of the code?
-
i don't know much about this thing but i think this connectionstring should take care of this
Code:
dim cn as new sqlconnection()
cn.connectionstring="integrated security=true;initial catalog=northwind")
that is, if your database to access is northwind...