Ok so I've taken it, ripped it a part and glued it back together to fit my needs (see code below) now how can I go through the data/check that the row was found, is there a simple tutorial on datasets, adapters and such seeing as I'm used to coming from PHP & MySQL which is an entirely different ball game altogether.
Here's the code I've changed (will it still work? As I've said I don't know it too well and I'm learning on the go):
Dim sqlCmd As New SqlCommand()
sqlCmd.CommandType = CommandType.Text
sqlCmd.CommandText = "SELECT * FROM tUsers WHERE uAlias = @varAlias AND uPass = @varPass;"
sqlCmd.Parameters.AddWithValue("@varAlias", txAlias.Text)
sqlCmd.Parameters.AddWithValue("@varPass", varPassword)
Dim sqlCmdResults As New DataSet
sqlCmdResults = sqlQuery(sqlCmd)
Public Function sqlQuery(ByVal dbSqlCommand As SqlCommand) As DataSet
'Set the connection string
Dim dbConnectionString As String = "Data Source=LAMBDA\SQLEXPRESS;Initial Catalog=Rain;User ID=Skyrail;Password=*****"
'Create a database connection function
Dim dbConnection As New SqlConnection(dbConnectionString)
'Set up the database adapter
Dim dbAdapter As New SqlDataAdapter()
'Create a dataset to put data into
Dim dbResultData As New DataSet()
'Put the connection data into the function
dbSqlCommand.Connection = dbConnection
'Something to do with the adapter
dbAdapter.SelectCommand = dbSqlCommand
'Open the connection
dbConnection.Open()
'Try and put data into the adapter
Try
dbAdapter.Fill(dbResultData)
Finally
dbConnection.Close()
End Try
Return dbResultData
End Function
Thanks once again, it looks a lot cleaner now and I'm hoping it will work efficiently