I am trying to fidn out how to read a frikin database. I can't seem to find anythign that tells me how. I am using web matrix so it has code snippits and it does have one for reading a db, but then i don't know what to do after it makes the function. here's what i ahve:
i don't know what any of that is, but the snipit thing put it there.Code:Function MyQueryMethod(ByVal iDData As Integer) As System.Data.SqlClient.SqlDataReader Dim connectionString As String = "server='localhost'; trusted_connection=true; Database='testdb'" Dim sqlConnection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionString) Dim queryString As String = "SELECT [TestTable].[IDData], [TestTable].[ValueData] FROM [TestTable] WHERE ([Tes"& _ "tTable].[IDData] = @IDData)" Dim sqlCommand As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(queryString, sqlConnection) sqlCommand.Parameters.Add("@IDData", System.Data.SqlDbType.Int).Value = iDData sqlConnection.Open Dim dataReader As System.Data.SqlClient.SqlDataReader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection) Return dataReader End Function
now what the hell do i do after i have that?!




Reply With Quote