Need Help When Creating sql connection object

bhavin12300

Active member
Joined
Sep 18, 2007
Messages
44
Programming Experience
Beginner
hi
i am totally new to this vb.net application.
i its very nice to work with this techology.

now my problem
i am creating simple database application in which i want to connect to the datanbase when user click a button.
so i am crearting connection in cliclk event by creating a sqlconnection object.

but when i try to odatain this object by following code


Dim objConnection As SqlConnection = New _
SqlConnection("Server=localhost;Database=pubs;" & _
"User ID=sa;Password=vbdotnet;")


and simply build the application its give me following error.

like

VB.NET:
Error	1	'SqlConnection' is ambiguous in the namespace 'System.Data.SqlClient'.


so anyone tell me how to slove this error.

i had already import classes like system.data as well as system.data.sqlclient

so anyone can help me with this
please do tell me about this how to slove this thing

waiting for your reply
 
Before you get too deep into whatever web tutorial youre following, you should be aware that it looks like youre learning the old (not good) ways of data access. For an idea of how we do things in the noughties ('00s as in 2000 - 2009) read the DW2 link in my signature, section on Creating a Simple Data App
 
Back
Top