|
-
Apr 20th, 2006, 04:59 AM
#1
Thread Starter
Member
[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
Last edited by kashi_rock; Apr 21st, 2006 at 03:48 AM.
-
Apr 20th, 2006, 05:35 AM
#2
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.
-
Apr 20th, 2006, 06:01 AM
#3
Thread Starter
Member
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
-
Apr 20th, 2006, 06:07 AM
#4
Re: [2005] Add records to a MDB file
-
Apr 20th, 2006, 11:40 PM
#5
Thread Starter
Member
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
-
Apr 21st, 2006, 01:32 AM
#6
Thread Starter
Member
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
-
Apr 21st, 2006, 01:38 AM
#7
Re: [2005] Add records to a MDB file
You misunderstand what the SelectedText property does.
http://www.vbforums.com/showthread.p...t=selectedtext
-
Apr 21st, 2006, 03:51 AM
#8
Thread Starter
Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|