To get the id you could use the following:
userDataset = myUserVAlidation(enterUsername, enterPassword)
If userDataset.tables(0).rows.count = 1 then
'found record in database table
ENd ifFunction myUserValidation(ByVal username as string, byVal password as string)
Dim connectionString as ...
Dim sqlConn as system.data.sqlclient.sqlconnection = new system.data.sqlClient.sqlconnection(connectionSTring)
Dim sqlString as string = "Select [userTable][username], [userTable][password], [userTable][fullName], [userTable][id] where (([userTable].[username] = @dotnet.itags.org.username) and ([userTable].[password] = @dotnet.itags.org.password))"Dim sqlCommand as system.data.sqlclient.sqlcommand = new system.data.sqlclient.sqlCommand(sqlString, sqlConn)
sqlCommand.parameters.add("@dotnet.itags.org.username", system.data.sqldbtype.varchar).value = username
sqlCommand.parameters.add("@dotnet.itags.org.password", system.data.sqldbtype.varchar).value = passworddim dataAdapter as system.data.sqlclient.sqldataadapter = new system.data.sqlclient.sqldataadapter(sqlCommand)
dim dataset as system.data.dataset = new system.data.dataset
dataadapter.fill(dataset)
return datasetend function
string id = userDataset.Tables[0].Rows[0].ItemArray.GetValue(3)The index for GetValue = 3 because id is the 4th column returned from your sql statement.
0 comments:
Post a Comment