473,396 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Binding gridview to Database table

Hi,

I have a datagridview1, which has a comboboxcolumn categoryname(which is binded to a database table Category )

listCol.DataSource = cDS.Tables["Category"];

datagridview1 also has two textbox column named description and amount which are not binded to any datasource.

Now I want to bind this datagridview1 to a new database table called transact_table, so that whatever the user selects from the combboxcolumn and whatever the user types in the textbox of the datagridview has to be written in my database table transact_table.

this is how I am trying:

Expand|Select|Wrap|Line Numbers
  1.  SqlDataAdapter transactDataAdapter = new SqlDataAdapter("select * from Transact_table", connection);
  2.           //DataTable pTable1 = cDS.Tables["Table"];
  3.           DataTable pTable1 = new DataTable();
  4.           transactDataAdapter.Fill(pTable1);
  5.           dataGridView1.DataSource = cDS.Tables["Table"];
  6.         transactDataAdapter.Update(pTable1);
  7.  
  8.  
this code is not working.
Mar 11 '09 #1
0 2652

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: rob | last post by:
Here is my scenario: One of my aspx pages has a CheckBoxList (Item1, Item2) and a GridView. Then I have a database that has the columns Item1 and Item2 (among others) with the data type bit....
9
by: Timm | last post by:
I have an ASP.NET 2.0 page with two DropDownLists. I am using declarative data binding wherever possible and trying to minimize the use of code. The list of values in DropDownList DDL2 should be...
2
by: Tim | last post by:
I have a radio button list control in the edit item template of a formview, as below. I want to bind this to a bit field from my sql database, however I can't seem to figure it out. Could some...
5
by: Amit | last post by:
Hello, I have a simple search screen, with two drop-downs and a text box. There's also a GridView control that is using a SqlDataSource control to show the matching results. The SqlDataSource uses...
1
by: Chris | last post by:
I have two SQLDataControls on a page. The first pulls all the data from a table and is then bound to a gridview. The second uses the selected value in the gridview which is in turn bound to a...
8
by: AG | last post by:
ASP.NET 2.0, VS 2005 I have a gridview with paging enabled, bound to an objectdatasource. Both were dropped on to the page and configured via the wizards. Basically working as expected. The...
2
by: Greg | last post by:
Hello, I am trying to bind a GridView to a custom object I have created. First, here is what I'm trying to do: I have a wizard for adding/editing Users. When the wizard begins, a User...
1
by: MikeB | last post by:
ooh boy, I hope I'm in the right place to ask this. I'm trying to do a class project that binds controls to data sources. I have a Drop-down List that I bound to the Author column of an SQL...
2
by: charlesjylee | last post by:
I am working with Netscape 7.0 and need to bind a <divwith the innerHTML property. More specifically, I need to bind a GridView in the div in question. I am binding the div with some hardcoded...
1
by: Monty M. | last post by:
Does anyone know how to perform two way data binding between a combo box and a listview. The listview is bound to a dataset table in code: Binding Bind = new Binding(); DataTable dt;...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.