Moti Mashiah
asked on
Visual basic
Hi guys,
I'm doing some query to get a parameter from SQL.
I have one issue here:
I can't get the value- Dim getRow = Convert.ToInt32(cmd.Parame ters(0).Va lue)
I'm doing some query to get a parameter from SQL.
Using cmd As New SqlCommand("select * from" + " " + tablen + " " + "where id=@rowid", Basewebpage.Passport.Connection)
cmd.Parameters.AddWithValue("@rowid", rowid)
Dim getRow = Convert.ToInt32(cmd.Parameters(0).Value)
End Using
I have one issue here:
I can't get the value- Dim getRow = Convert.ToInt32(cmd.Parame
ASKER
Thank you for your answer.
can you just tell me how to pass the let's say column 0 only?
can I do
Dim getRow = Convert.ToInt32(cmd.Execut eScalar(0) )
can you just tell me how to pass the let's say column 0 only?
can I do
Dim getRow = Convert.ToInt32(cmd.Execut
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Basically U gave me a good solution but still it doesn't return a value just a boolean it there is data or not and this is good enough foe me.
Open in new window
https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executescalar(v=vs.110).aspx