Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 9th, 2004, 12:43 AM
chcasboi chcasboi is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 50 chcasboi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 51 m 24 sec
Reputation Power: 5
Send a message via AIM to chcasboi
Unhappy Using VB.NET to insert into a row in Access

How would I go about using VB.NET to insert data into a row in a table. I have the GUI setup and its components are databound to the database. My connection string is "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & ("OSR_Tracking/OSR_Tracking.mdb")

and I use this as a start for my sql statement but am not getting any where

Me.OleDbInsertCommand1.CommandText = "INSERT INTO OSR_Tracking(Contact_Person, Education, Experation_Date, Leader_Commi" & _
"ted, Leader_Info, Member_1_Commited, Member_1_Info, Member_2_Commited, Member_2_" & _
"Info, Member_3_Commited, Member_3_Info, Member_4_Commited, Member_4_Info, Member" & _
"_5_Commited, Member_5_Info, Member_6_Commited, Member_6_Info, Member_Address, Me" & _
"mber_City, [Member_E-mail], Member_Name, Member_Phone, Member_State, Member_Zip," & _
" Notes, Order_Standards, ORS_Member_5, OSR_Date, OSR_Leader, OSR_Member_1, OSR_M" & _
"ember_2, OSR_Member_3, OSR_Member_4, OSR_Member_6, Rehabilitation, Reminder_Lett" & _
"er)VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?," & _
" ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"

Thanks for the help.

Charley

Reply With Quote
  #2  
Old January 9th, 2004, 10:34 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
What is you error message?

S-

Reply With Quote
  #3  
Old January 9th, 2004, 06:43 PM
chcasboi chcasboi is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 50 chcasboi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 51 m 24 sec
Reputation Power: 5
Send a message via AIM to chcasboi
sorry no error message appears it compiles but there is no insertion of data into the table. This is what is the big stump for me. I have little experience with SQL. Therefore I am confused on the correct statement to use and what else needs to be added, like an open statement of some sort or the like

Reply With Quote
  #4  
Old January 10th, 2004, 10:02 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
I sthis your actual SQL statement. or have you jsut subsitutied ? for the actual variables that you are using.

If you are really trying to insert "?" then you will have problems as it looks like some of your fields are Dates and you won't beable to insert a ? in that field

Post you real statement if this isn't it.

S-

Reply With Quote
  #5  
Old January 10th, 2004, 10:17 PM
chcasboi chcasboi is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 50 chcasboi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 51 m 24 sec
Reputation Power: 5
Send a message via AIM to chcasboi
That is my real statement or at least part of it. I am trying to attach my project. But can not seem to get it to work will try to edit original to attach. I posted this same question on the .NET forum here is the link;

http://forums.aspfree.com/forumdisp...1000&forumid=11


Thanks for the reply

Charley

Last edited by chcasboi : January 10th, 2004 at 10:36 PM.

Reply With Quote
  #6  
Old January 11th, 2004, 01:11 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
Click here for more information.
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,781 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 45 m 55 sec
Reputation Power: 470
Code:
Me.OleDbInsertCommand1.CommandText = "INSERT INTO TableName VALUES('" & Trim$(txtField.Text) & "')"

Reply With Quote
  #7  
Old January 12th, 2004, 02:22 AM
chcasboi chcasboi is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 50 chcasboi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 51 m 24 sec
Reputation Power: 5
Send a message via AIM to chcasboi
I tried the '" & Trim$(txtField.Text) & "' suggestion but I get errors, I switched it to something I found on a site that is this

' My connection string not sure it is compiles but not sure
' if it really is needed or done coorectly, i am trying to model after my web project
Me.OleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & ("OSR_Tracking/OSR_Tracking.mdb")
' My attempt to define the insertcommand not sure that it will work
Me.OleDbDataAdapter1.InsertCommand = Me.OleDbInsertCommand1
' the changed sql statement if correct I used an example from a chapter snippet I read
Me.OleDbInsertCommand1.CommandText = "INSERT INTO OSR_Tracking(Contact_Person, Education, Experation_Date, Leader_Commi" & _
"ted, Leader_Info, Member_1_Commited, Member_1_Info, Member_2_Commited, Member_2_" & _
"Info, Member_3_Commited, Member_3_Info, Member_4_Commited, Member_4_Info, Member" & _
"_5_Commited, Member_5_Info, Member_6_Commited, Member_6_Info, Member_Address, Me" & _
"mber_City, [Member_E-mail], Member_Name, Member_Phone, Member_State, Member_Zip," & _
" Notes, Order_Standards, ORS_Member_5, OSR_Date, OSR_Leader, OSR_Member_1, OSR_M" & _
"ember_2, OSR_Member_3, OSR_Member_4, OSR_Member_6, Rehabilitation, Reminder_Lett" & _
"er) VALUES (Contact_Person_Text, Education_Check, Acc_Exp_Date_Text, ?, 0, One_Commitment_Check, Leader_Info_Text, Two_Commitment_Check, Member_2_Info_Text, Three_Commitment_Check, Member_3_Info_Text, Four_Commitment_Check, Member_4_Info_Text, Five_Commitment_Check, Member_5_Info_Text, Six_Commitment_Check, Member_6_Info_Text, Member_Address_Text, Member_City_Text, Member_Email_Text, Member_Name_Text, Member_Phone_Text, Member_State_ListBox, Member_Zip_Text, Notes_Text," & _
" Order_Standards_Check, ?, OSR_Date_Text, Leader_Name_Text, Member_2_Name_Text, Member_3_Name_Text, Member_4_Name_Text, Member_5_Name_Text, Member_6_Name_Text, Rehabilitation_Check, Reminder_Letter_Check)"

It is much to read but I wanted to include it all so you can see what I am thinking.

Thanks again for the reply

Charley

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Using VB.NET to insert into a row in Access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT