ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 9th, 2003, 06:39 AM
HuGo HuGo is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Sweden
Posts: 1 HuGo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to HuGo
Question VB.net INSERT problem

I'm trying to insert some data from a windows form to a access database.

Here is a bit from my code where the error occurs:


rows = countRowsInDatabase()
getDataString = String.Concat("INSERT INTO dates (Id,Task,year, month, day, hour, minute, beskrivning) VALUES ('", rows, "','", TextBox2.Text, "', '", yearString, "', '", monthString, "', '", dayString, "', '", hourString, "', '", minuteString, "', ", TextBox1.Text, "')")
TextBox1.Text = getDataString

Try
DBcon1.Open()
myOledbCommand.Connection = DBcon1
myOledbCommand.CommandText = getDataString
myOledbCommand.ExecuteNonQuery()

Catch ex As Exception
MsgBox(ex.ToString)
Finally
DBcon1.Close()
myOledbCommand.Dispose()
End Try
End If

Me.Close()
End Sub


The error message is syntax error in INSERT INTO expression.

Can anyone see what I am doing wrong?

/HuGo

Last edited by HuGo : July 9th, 2003 at 06:53 AM.

Reply With Quote
  #2  
Old July 18th, 2003, 01:37 PM
numbernine numbernine is offline
Up To His Eyes In Ads
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Chicago
Posts: 160 numbernine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 25 sec
Reputation Power: 6
Whenever you have problems like this, print your SQL string and look at it. Often you'll see the problem right away. Otherwise, copying it and running it directly against the database will tell you what's wrong.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > VB.net INSERT problem


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 4 hosted by Hostway
Stay green...Green IT