Having problem getting query executed in a DataSet

W

weird0

What I did is create a Dataset and then the option "To select
multiple columns was grey"
so forcefully I had to "To select the one that returns a single
value".

I wrote the query for it which is as follows:

SELECT atm_amount,atm_branch,atm_date,balance FROM ATM_Transactions
WHERE user_id=Session["UserId"]

The error it gives is:

Incorrect syntax near "UserId".

Can anyone help me?
 
M

Michael Nemtsev

Hello weird0,

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

w> What I did is create a Dataset and then the option "To select
w> multiple columns was grey"
w> so forcefully I had to "To select the one that returns a single
w> value".
w> I wrote the query for it which is as follows:
w>
w> SELECT atm_amount,atm_branch,atm_date,balance FROM ATM_Transactions
w> WHERE user_id=Session["UserId"]
w>
w> The error it gives is:
w>
w> Incorrect syntax near "UserId".

What is the "Session["UserId"]" ?!

Maybe u need to use @USERID instead of this
and then using connection.Parameters.AddWithValue(@USERID, Session["UserId"])
?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top