By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,238 Members | 1,485 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,238 IT Pros & Developers. It's quick & easy.

datagrid help

P: n/a
I am quite new to VB.net and I am struggling with the datagrid. I want to
let the user modify data in the grid and then click the save button and this
will update the database. I guess I am having trouble understanding the
update command and the parameters. The data is coming from an SQL query on
2 tables, but I will only need to update one of them. I got the grid to
show the data but I can't get it to update. This is my SQL statement

Private Const SELECT_STRING = "SELECT equipment.eqp_description, as
Equipment,io_master.io_number, io_master.io_panel_id,equipment.eqp_id,
io_master.equipment_io_function FROM io_master Left outer join equipment on
io_master.eqp_id = equipment.eqp_id order by io_master.io_number"

My update needs to be this:

UPDATE io_master SET equipment_io_function = ? WHERE io_panel_id = ?

I'm guessing that this is right:

Dim cupdate As OdbcCommand = New OdbcCommand("UPDATE io_master SET
equipment_io_function = ? WHERE io_panel_id = ?", OdbcConnection)

and then I set the odbcAdapter.updatecommand = cUpdate

My problem is I don't quite understand the cUpdate.Parameters.add

Can someone help me with what I should put in there?
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Altman,

First question Windowforms or Webforms and than why are you using ODBC
instead of OleDb. ODBC will give you much more work.

Cor
Nov 21 '05 #2

P: n/a
it is for a window forms and we are using ODBC because it is already set up
for Crystal Reports. This means the application will not have to find out
from the user where the DB is located. Otherwise I would have used OLEDB.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:ei**************@TK2MSFTNGP11.phx.gbl...
Altman,

First question Windowforms or Webforms and than why are you using ODBC
instead of OleDb. ODBC will give you much more work.

Cor

Nov 21 '05 #3

P: n/a
Altman,

The ODBC is not always save however I saw that there is as well an
commandbuilder for ODBC which maybe makes your live as easy as it is with
OleDb.

http://msdn.microsoft.com/library/de...classtopic.asp

Althouhg it has with OleDb as well bugs, or maybe I am wrong because while I
write this I remember me that the one who always tells that the
commandbuilder has bugs likes very much ODBC.

However maybe it will make your live much easier

Cor

"Altman" <No******@SickOfSpam.com>
..
it is for a window forms and we are using ODBC because it is already set
up for Crystal Reports. This means the application will not have to find
out from the user where the DB is located. Otherwise I would have used
OLEDB.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:ei**************@TK2MSFTNGP11.phx.gbl...
Altman,

First question Windowforms or Webforms and than why are you using ODBC
instead of OleDb. ODBC will give you much more work.

Cor


Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.