HI ALL
I HAVE SMALL PROPLEM I CANT SOLVE AND I THINK ITS SIMPLE
I ONLY TRY TO FILL THE DATASET WITH TABLEADABTER BY SELECT WHERE IN FILL,GET METHOD BY
SELECT STENAME, PATENT, RCOMER
FROM FOURNI
WHERE (RCOMER =@RCOMER)

I ALWAYS GOT THE ERROR
Error in WHERE clause near '@'
Unabe to parse query text.

PLZ HELP

Recommended Answers

All 4 Replies

use sqlcommand , for this purpose

dim con as new sqlconnection("connection string")
con.open()
dim cmd as new sqlcommand 
cmd.connection = con
cmd.commandtext = "your query"
cmd.parameters.add("@rcomer",datatype).value = yourvalue 'cmd.parameters.add("@rcomer",int).value = val(textbox1.text)
cmd.executenonquery();
con.close()

may be there is some spelling mistakes , as i type directly here , so you can check those spellings in VS ,
or directly use your values inside the query , like this

dim myQuery as string 
myQuery = "Select a,b,c from table1 where d=" & txtbox1.text

hope this will solve your problem

THANK ALOT FOR UR REPLAY TRES GENTILLE
BUT I AM TRAYING TO FILL THE DATASET BY THIS METHOD NOT BY THE METHOD OF sqlcommand
I AM TRYING THIS
tableAdapter.Fill(DS.TABLE, Texrc.Text)
IS IT WRONG
THNX AGAIN

ohhh :P , well use this code to fill :)

dim con as new sqlconnection("string_connection")
dim ds as new dataset
con.open()
dim da as new sqldataadapter("select....from....",con)
ds.table("table1").clear()
da.fill(ds,"table1")
'now you can use this table to fill or populate any control like grid 
gridview1.datasource= ds.table("table1")

hope this time this code will help you :)

Regards
M.Waqas Aslam

ohhhhh thnk alot i got it you are the best ty

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.