Hi
I have tried the code below to ask a question from an Access database, but I
don't get any records wich I know I should.
sökaOrdCom = New OleDbCommand("Select * from kött where köttid Like
@KöttID", DBConn)
sökaParam.ParameterName = "@KöttID"
sökaParam.DbType = DbType.String
sökaParam.SourceColumn = "Köttid"
sökaParam.Value = "'" & PubStr & "*'"
sökaOrdCom.Parameters.Add(sökaParam)
Trace.WriteLine(sökaOrdCom.CommandText)
sökaOrdRead = sökaOrdCom.ExecuteReader
Do While sökaOrdRead.Read
recCount += 1 'This code never happens
Loop
sökaOrdRead.Close()
I have also tried the code below but I this isn't working either.
sökaOrdCom = New OleDbCommand("Select * from kött where köttid Like
@KöttID", DBConn)
sökaOrdCom.Parameters.Add("@KöttID","'" & PubStr & "*'")
Trace.WriteLine(sökaOrdCom.CommandText)
sökaOrdRead = sökaOrdCom.ExecuteReader
Do While sökaOrdRead.Read
recCount += 1 'This code never happens
Loop
sökaOrdRead.Close()
I thought that when you added the parameter the CommandText should look like
this if PubStr = 'b'
"Select * from kött where köttid Like 'b*'", but it doesnt it still looks
the same.
I have no idea why this isn't working. I hope some of you have.
I miss the property RecordCount, isn't there any property like that in
Visual Basic .NET or do you have to run a while loop to get the recordcount.
PLEASE HELP!!
Fia