Community discussion forum

Need help working with Ado.net

  • 10 months ago
    I am new to VB, I made a table using ado, but I need to pass the data from a datagrid to the table. The code for the table is like this: Dim TableName As String = "" 'Giving name to the table TableName = "Pareo" Dim dsStr As String Dim dsCn As String Dim cnADO As ADODB.Connection Dim mdb As ADOX.Catalog Dim dt As ADOX.Table Try mdb = New ADOX.Catalog() cnADO = New ADODB.Connection() dsStr = My.Settings.DataSource dsCn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dsStr + ";" cnADO.ConnectionString = dsCn cnADO.Open() mdb.ActiveConnection = cnADO 'Creating the table dt = New ADOX.Table() dt.Name = nombreTabla dt.Columns.Append("Num", ADOX.DataTypeEnum.adWChar, 5) dt.Columns.Append("NI", ADOX.DataTypeEnum.adWChar, 10) dt.Columns.Append("Name", ADOX.DataTypeEnum.adWChar, 20) dt.Columns.Append("Rnd" & i, ADOX.DataTypeEnum.adWChar, 5) dt.Columns.Append("EloBirdInicial", ADOX.DataTypeEnum.adWChar, 10) dt.Columns.Append("EloBirdFinal", ADOX.DataTypeEnum.adWChar, 10) dt.Keys.Append("PK_NewTable", ADOX.KeyTypeEnum.adKeyPrimary, _ "NI") mdb.Tables.Append(dt) Catch ex As Exception MessageBox.Show(ex.Message, "The table was not created") End End Try MessageBox.Show("The table was created", "Now", MessageBoxButtons.OK) End I need to pass data form a datagrid to this table, I hope someone can help me
    Post was edited on 26/12/2008 15:44:59 Report abuse

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!