473,663 Members | 2,854 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i have to insert data from datagridview to databse

3 New Member
hello friends.......
i have to insert multiple rows fromdatagridvie w to database.friend s i am inserting a single row by using following code....

settings.ExeNon Query("insert into RECORD(Filename ,[Filecode],Rackno,[Filegroup],Shelfno,[Month],Remarks) " & _
" values('" & DataGridView1.C urrentRow.Cells (0).Value & "','" & DataGridView1.C urrentRow.Cells (1).Value & "', " & _
" " & DataGridView1.C urrentRow.Cells (2).Value & ",'" & DataGridView1.C urrentRow.Cells (3).Value & "', " & _
" '" & DataGridView1.C urrentRow.Cells (4).Value & "','" & DataGridView1.C urrentRow.Cells (5).Value & "','" & DataGridView1.C urrentRow.Cells (6).Value & "')")
plz help me ........
its very urgent......... ............... ...
Feb 8 '08 #1
1 1381
DrBunchman
979 Recognized Expert Contributor
Hi sandeepdhole,

In order to insert multiple records simply loop through each item in the DataGridView that you wish to insert and run the insert statement for each one.

Or have i misunderstood the question!?

Dr B
Feb 8 '08 #2

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

Similar topics

4
11831
by: authorking | last post by:
I use the following code to insert a data record in to a datatable of an access database.But every time I execute the command, there will rise an exception and the insert operation can't be completed. here's the code: System.Data.OleDb.OleDbConnection hist_cnn = new System.Data.OleDb.OleDbConnection(); System.Data.OleDb.OleDbCommand hist_command = new System.Data.OleDb.OleDbCommand();
1
1895
by: authorking | last post by:
I create the databse with the follwing code. I really don't know why the insert operation can't be completed. databse creation code: ADOX.CatalogClass cat = new ADOX.CatalogClass();//define a Jet database class cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=history_data.mdb;" + "Jet OLEDB:Engine Type=5");//create a Jet database System.Data.OleDb.OleDbConnection hist_cnn = new System.Data.OleDb.OleDbConnection();
0
2116
by: Dave | last post by:
I have a table with 3 fields of which the primary key is a autonumber. I have created my dataadapter, dataset and datagridview using a wizard. However, in the datagrid, the update and delete operation work but the Insert will not work. I know I to make changes to code but it does not seem to work. portion of the error reads: The following exception occurred in the DataGridView: System.Data.NoNullAllowedException: Column 'ID' does not...
1
6938
by: Dave | last post by:
I have a table with 3 fields of which the primary key is a autonumber. I have created my dataadapter, dataset and datagridview using a wizard. However, in the datagrid, the update and delete operation work but the Insert will not work. I know I to make changes to code but it does not seem to work. portion of the error reads: The following exception occurred in the DataGridView: System.Data.NoNullAllowedException: Column 'ID' does not...
4
39754
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
how do you insert a new row to a databound datagridview? It won't allow this action.
4
4854
by: =?Utf-8?B?UmljaA==?= | last post by:
On a form - I have a datagridview which is docked to the entire form. The datagridview allows users to Delete and/or Add Rows. On the Form_Load event I Fill the datagridview source table with a sql DataAdapter (da) da.SelectCommand.CommandText = "Select * from Servertbl1" da.Fill(ds, "tbl1") so far, so good. If I add a row to the datagridview I use the following sqlDataAdapter code to update the server table - which works OK when...
13
8866
by: Terry Olsen | last post by:
I'm using OleDb to connect with an Access Database. I have anywhere from 10 to over 100 records that I need to either INSERT if the PK doesn't exist or UPDATE if the PK does exist, all in a single transaction. Does anyone have an SQL statement I can throw at it that would accomplish this? If I can't figure out how to do it, I'm going to have to send two discreet SQL commands for each record which will take infinitely longer than a...
0
2122
by: Andrus | last post by:
I tried to edit data in DataGridView. Insert and delete operations in grid are not saved to database. Updating works OK. How to force grid to save Insert and Delete operations also ? Andrus. Northwind db = CreateDB(); var list = new BindingList<Customer>(db.GetTable<Customer>().ToList() );
0
1876
by: jchaturv | last post by:
All, I have a customized DataGridView where I have implemented extra functionality and bounded datasource in the same custom DataGridView (Using C# and .NET). Now, I could able to use it properly by placing it on a panel control. I have added label as button on panel control to display data from datasource on to datagrid and create a binding source. Another Label which act as a button is used to update data from grid to databse.
0
8436
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8858
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8548
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5657
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4182
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1757
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.