If you Import the System.Data.SqlClient namespace you won't have to fully
qualify the types the way I did. Hope it helps.
Jared
Dim conn As New
System.Data.SqlClient.SqlConnection("Server=YourServerName;Database=YourDBName;Trusted_Connection=True;")
Dim cmd As New System.Data.SqlClient.SqlCommand("SELECT * FROM Customers
WHERE CustomerID=@CustomerID", conn)
cmd.Parameters.Add("@CustomerID", SqlDbType.VarChar)
cmd.Parameters("@CustomerID").Value = "Some_Value_You_Set"
Try
conn.Open()
Dim Reader As System.Data.SqlClient.SqlDataReader = cmd.ExecuteReader
'Do something with the reader here.
Catch sqlex As SqlClient.SqlException
'code to process sql errors
Catch ex As Exception
'code to process other errors
Finally
conn.Close()
End Try
"Paul Smith" <Paul
(E-Mail Removed)> wrote in message
news:413A8D17-8444-4B82-A324-(E-Mail Removed)...
> Hi I am new to this game.
>
> I am trying to compile an applicaiton with an sql database.
>
> I have a form and have linked to a certain table and the correct fields
> display the correct values.
>
> I have then added a combo box onto the form, would like to click a certain
> persons name, and then it would display there information on the form. I
> have followed some of microsoft walkthrough's - but after puttng in a try
> catch - the error is saying:
>
> Prepared statement '"@user_nameparam nvarchar(255)) SELECT employeeID,
> User_Name, log' expects parameter @user_nameparam, which was not supplied
>
> Any help greatly appreciated