473,508 Members | 2,327 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datagrid help

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
3 1241
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3022
by: Stephen | last post by:
I've got a datagrid with a remove button and I would like to add some code in the code behind page so as whenthe button is clicked the corresponding row in the datagrid is removed. The Datagrid is...
2
9906
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell...
3
5020
by: Ryan Liu | last post by:
Hi there, I got a NullReferenceException when delete last row in a datagrid. I had hard time to solve since it does not occur in my own code. I put a datagrid in my inherited user control,...
4
5335
by: Glenn Owens | last post by:
I have a DataGrid web control which I've dynamically populated with template columns to be used for bulk-editting. Generally, all of the columns are textbox and/or dropdownlist child controls. ...
0
1683
by: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a...
5
5887
by: Genojoe | last post by:
I am using code from Help with two exceptions. (1) I increased the number of sample rows from 3 to 20, and (2) I anchored the datagrid to bottom of form so that I can change the size of the grid by...
14
1822
by: Brett Sinclair | last post by:
Hello everybody I'm still on the learning curve here...and from what I read, I created inherited datagrid class so I could have icons, combobox...etc in the columns of my datagrid. The grid...
4
2116
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a...
9
2708
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
10
2935
by: amiga500 | last post by:
Hello, I have one basic simple question. When I have multiple records in the datagrid as follows: Code Product 1 Product 2 Product 3 11111 A B C...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7120
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5050
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.