borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Drag and Drop image)Next Topic (Master VB.NET And Get your MCP NOW!!!) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : data inserted in dynamically created column
Poster Message
tanmoy
Level: Whizz Kid

Registered: 17-03-2006
Posts: 18

icon 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

20-04-2006 at 09:23 PM
View Profile Send Email to User Show All Posts | Quote Reply
tanmoy
Level: Whizz Kid

Registered: 17-03-2006
Posts: 18
icon Re: data inserted in dynamically created column

Please help me any one.please.

____________________________
ambarish sadhu

24-04-2006 at 04:30 PM
View Profile Send Email to User Show All Posts | Quote Reply
tanmoy
Level: Whizz Kid

Registered: 17-03-2006
Posts: 18
icon Re: data inserted in dynamically created column

if i dont use ds.reset() function then the data is not inserted.but if i use this function the is inserted only single time. i mean if i insert data 1st time then if i terminate from programe and yhen start the data inserted.but without terminate the programe the data is not inserted more then 1 times.please help me any one.plzzzzzzzzzzzzzzzzzzzzzz.thank you


____________________________
ambarish sadhu

27-04-2006 at 07:16 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: data inserted in dynamically created column

You dont tell how do you generate data adapters UpdateCommand? When you add column to table you need to regenereate queries for the data adapters's command objects.

____________________________
If you find the answer helpful, please mark this topic as solved.

27-04-2006 at 11:47 PM
View Profile Send Email to User Show All Posts | Quote Reply
Bharathi
Level: Scholar

Registered: 11-04-2005
Posts: 31
icon Re: data inserted in dynamically created column

Hi,

TRy this Title:"Database programming using vb.net and sql server", by VK publishers.

08-06-2006 at 08:14 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : VB.Net : data inserted in dynamically created column
Previous Topic (Drag and Drop image)Next Topic (Master VB.NET And Get your MCP NOW!!!) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder