tanmoy Level: Whizz Kid
 Registered: 17-03-2006 Posts: 18
|
data inserted in dynamically created column
hello sir.i want to add column dynamically in a table in my database and also want to add data in this dynamically create column.my provlem is i creat column dynamically but in this dynamically create column data is not inserted.i use this coding.
Dim flag As Integer
strSQL1 = "alter table tran add " & l & " number"
cmd1 = New OleDb.OleDbCommand(strSQL1, con)
cmd1.ExecuteNonQuery()
strSQL1 = "alter table tran add Totamn number "
cmd1 = New OleDb.OleDbCommand(strSQL1, con)
cmd1.ExecuteNonQuery()
ds.Reset()
'////come total amount in tran table
'ds.Clear()
adpt7.Fill(ds, "tran")
adpt6.Fill(ds, "backupinv")
Dim tm As Integer
For tm = 0 To tr.BindingContext(ds.Tables("backupinv")).Count - 1
If ds.Tables("tran").Rows(tm).Item(0) = ds.Tables("backupinv").Rows(tm).Item(0) Then
'MsgBox(ds.Tables("backupinv").Rows(tm).Item("Totamn"))
ds.Tables("tran").Rows(tm).Item("Totamn") = ds.Tables("backupinv").Rows(tm).Item("Totamn")
adpt7.Update(ds, "tran")
End If
Next
in this coding i have created dynamically column and the data is inserted only single time.i mean 1st whem i create a dynamically field the data is inserted but when i create 2nd time dynamically field the data is not inserted.but if i close my programe and then run this programe the data is inserted in this column.actually my problem is i have created column dunamically but the data is not icserted in this column.if i close the programe and then run the data is inserted in this column.but i want to add column dynamically and also data inserted dynamically in this column without close the programe. please help me.thank you.
[Edited by tanmoy on 22-04-2006 at 03:27 PM GMT]
[Edited by tanmoy on 22-04-2006 at 03:29 PM GMT]
____________________________
ambarish sadhu
|