473,465 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
Create 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 1232
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
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
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
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
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
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
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
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
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
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
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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
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
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.