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

Home Posts Topics Members FAQ

saving data problem (vb.net 2005)

2 New Member
hi all

I am using vb.net 2005 and sql server 2005.

I want to save data from datatable to directely into database without loop.

for the same purpose I have written the following code but its not working.

Private sub SaveData()
Dim MyAdapter As SqlDataAdapter
Dim cmd As SqlCommand

MyAdapter = New SqlDataAdapter
cmd = New SqlCommand("Insert into dtls_Combination values(1,AsstCls,Sch,Pla,Classf,Seg,Cat,InvTyp)")

With cmd.Parameters
.Add("AsstCls", SqlDbType.NVarChar, 100, "AssetClass")
.Add("Sch", SqlDbType.NVarChar, 100, "Scheme")
.Add("Pla", SqlDbType.NVarChar, 100, "Plans")
.Add("Classf", SqlDbType.NVarChar, 100, "Classification_Name")
.Add("Seg", SqlDbType.NVarChar, 100, "Segment_Name")
.Add("Cat", SqlDbType.NVarChar, 100, "Commission_Name")
.Add("InvTyp", SqlDbType.NVarChar, 100, "InvType_Name")
End With
cmd.Connection = cn
MyAdapter.InsertCommand = cmd
MyAdapter.Update(DtCombinations)
DtCombinations.AcceptChanges()

End Sub

I'm not getting error but my table is not updated with new rows..

pls help..

thank you

Hardik
Oct 12 '06 #1
0 1439

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

Similar topics

1
1193
by: pmclinn | last post by:
I have a formated a structure as follows: <Serializable()>public structure stcOutPut private data as string private visi as string end structure Instances of this strucuture are stored in an...
2
1558
by: all2neat | last post by:
hello. I can enter in data in the vb program itself and it will save data there but when i run my program and enter data it will not save the changes to the database. Any ideas on how to get my...
1
2589
by: Magnus | last post by:
I'm testing walkthrough saving data to a Database (Multiple Tables). http://msdn2.microsoft.com/en-us/library/4esb49b4(VS.80).aspx In the famous Customer/Order example, I'm getting referential...
1
1556
by: projectid2007 | last post by:
Hi, I'm using VS2005 and I'm trying to link the C# windows form to MSSQL. I used BindingNavigator Control to read the data. After that I add sqlcommand and sqldataadapter to send the data to the...
2
2837
by: Omar Abid | last post by:
Hi, I'm using the following code to open a data base and show it's content in a Data Grid View ---- Code ----- Imports System.Data.SqlClient Private Sub Form1_Load(ByVal sender As...
2
1101
by: Zeljko Bilandzija | last post by:
Hi, can somebody help me in this? I want to insert some data in table on this way; i have button, and in Button_Click event handler i have integer variable with some data (for example,...
2
1525
by: Michelle Monty | last post by:
Hi, I'm trying to create a program where the user can enter check information and the information is saved to a sequential access file. I'm getting an error when I run the program. The error is...
7
3580
by: Jon | last post by:
Hi, I plan to import some data from an old DOS-based programme. The data file format that this programme produced appears to be proprietary, but I've managed to reverse engineer the format and...
0
924
by: madhu raju | last post by:
iam saving the data into Ms-Access database using Vb.net Application In that application iam using Data grid view to save the data into the database Here in the below code iam saving the name of...
0
7114
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
7321
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
7377
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...
0
7488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
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
3191
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
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.