[2005] Add records to a MDB file [RESOLVED]
Hi Friends,
I am using VB2005 Express Edition but I m quite new to this version. I have some text strings in combo boxes & I have a output.mdb having a table called as data. Now I want to add those values into my table.
Can any one please help me out to pull me up from this dark side :(
Regards
Kashi
Re: [2005] Add records to a MDB file
There are a number of tutorials in my signature that are either ADO.NET-specific or have ADO.NET sections. The Start VB.NET site even has a section dedicated to ADO.NET with Access, but any ADO.NET information is directly relevant.
Re: [2005] Add records to a MDB file
hi jmcilhinney,
Thx for the guidence. Can you provide some source code for my better understanding.
Looking for your best support.
Thx. Kashi
Re: [2005] Add records to a MDB file
Re: [2005] Add records to a MDB file
hi jmcilhinney,
I have tried the code as you have suggested, but didn't found the success. Can you please write some code for my problem. I know I am taking your valuable time but please help me.
I have "Sheet_data.mdb" & I want to insert the records from "combobox1,2,3,4" into table "Data".
Using VB2005
Thx. Kashi
Re: [2005] Add records to a MDB file
hello all,
I have tried following code to insert records (projectname, projectcode, activityname, activitycode) from various combo boxes in table Data for sheet_data.mdb.
But Still I can not get the right things. Please suggest me where I m doing wrong:
Imports System.Data.OleDb
Public Class MainWindow
Dim connection As New OleDb.OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=C:\sheet_data.mdb")
Dim cmd As OleDbCommand
Dim icount As Integer
Dim str As String
Try
connection.Open()
str = "insert into data (projectname,projectcode,activityname,activitycode) values('" & ComboBox1.SelectedText & "'" & ComboBox3.SelectedText & "'" & ComboBox2.SelectedText & "'" & ComboBox4.SelectedText & ")"
cmd = New OleDbCommand(str, connection)
icount = cmd.ExecuteNonQuery
MessageBox.Show(icount)
Catch ex As Exception
End Try
connection.Close()
End Sub
End Class
Thx.
Kashi
Re: [2005] Add records to a MDB file
You misunderstand what the SelectedText property does.
http://www.vbforums.com/showthread.p...t=selectedtext
Re: [2005] Add records to a MDB file [RESOLVED]
hi jmcilhinney,
You have catched the exactly the right error. Actually I was not correctly getting the combobox values. But now its working fine.
Thx for your kind support.
Kashi