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