views:

25

answers:

1
   Dim j As New SqlDataSource
   Dim xId As String
   Dim y = j.ConnectionString("Data Source=pcname;Initial Catalog=database;Integrated Security=True")
   Dim query As String
   query = "SELECT *  FROM x WHERE username =" + Username + " AND Password = " + Password
   Dim result = j.SelectCommand(query)
   xId = j.SelectParameters('xId')
   return xId 

I do no it is right way to return XId field.

A bit confuse since this is first time i touch vb since vb6. Lot of changes.

Software Use : Visual Web Developer 2008 Express. Database Use : Sql Server 2008 Express.

A: 

This should give you a starting point of how to use SqlConnection

You should also seriously avoid using string concatenation for the Sql Query to avoid SqlInjection. Rather use SqlParameter Class

astander