Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

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 June 21st, 2005, 02:26 AM
hithere's Avatar
hithere hithere is offline
Learner
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: India
Posts: 450 hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 12 h 13 m 21 sec
Reputation Power: 17
runtime error in insert statement

Hi,
Whenever i try to insert records from csv file into sql table it gives me the following error
Runtime error '-2147217900(80040e14)'
Line 1: Incorrect syntax near ","

I dont find anything wrong in the insert statement
cmd.CommandText = "insert into TradingDetails values('" & Trim(rs(0)) & "','" & Trim(rs(1)) & "','" & Trim(rs(2)) & "','" & Trim(rs(3)) & "','" & ntimestamp & "','" & Trim(rs(5)) & "','" & Trim(rs(6)) & "','" & Trim(rs(7)) & "','" & Trim(rs(8)) & "','" & Trim(rs(9)) & "','" & Trim(rs(10)) & "','" & Trim(rs(11)) & "','" & Trim(rs(12)) & "','" & Trim(rs(13)) & "','" & Trim(rs(14)) & "'," & Trim(rs(15)) & "," & Trim(rs(16)) & "," & Trim(rs(17)) & ",'" & Trim(rs(18)) & "'," & Trim(rs(19)) & "," & Trim(rs(20)) & ",'" & Trim(rs(21)) & "','" & Trim(rs(22)) & "','" & Trim(rs(23)) & "','" & Trim(rs(24)) & "','" & Trim(rs(25)) & "','" & Trim(rs(26)) & "','" & Trim(rs(27)) & "','" & Trim(rs(28)) & "','" & Trim(rs(29)) & "','" & Trim(rs(30)) & "','" & _
Trim(rs(31)) & "','" & Trim(rs(32)) & "','" & Trim(rs(33)) & "','" & Trim(rs(34)) & "','" & Trim(rs(35)) & "','" & Trim(rs(36)) & "','" & Trim(rs(37)) & "','" & Trim(rs(38)) & "','" & nordertime & "','" & nentrytime & "','" & Trim(rs(41)) & "','" & Trim(rs(42)) & "','" & Trim(rs(43)) & "','" & Trim(rs(44)) & "','" & Trim(rs(45)) & "','" & Trim(rs(46)) & "','" & Trim(rs(47)) & "'," & Trim(rs(48)) & "," & Trim(rs(49)) & "," & Trim(rs(50)) & "," & Trim(rs(51)) & "," & Trim(rs(52)) & "," & Trim(rs(53)) & ",'" & ntradetime & "','" & Trim(rs(55)) & "','" & Trim(rs(56)) & "','" & Trim(rs(57)) & "','" & Trim(rs(58)) & "','" & Trim(rs(59)) & "','" & Trim(rs(60)) & "','" & _
Trim(rs(61)) & "','" & Trim(rs(62)) & "','" & nexpirydate & "','" & Trim(rs(64)) & "','" & Trim(rs(65)) & "','" & Trim(rs(66)) & "','" & Trim(rs(67)) & "','" & ncurrenttime & "','" & Trim(rs(69)) & "','" & Trim(rs(70)) & "','" & Trim(rs(71)) & "','" & Trim(rs(72)) & "','" & Trim(rs(73)) & "','" & Trim(rs(74)) & "','" & Trim(rs(75)) & "','" & Trim(rs(76)) & "','" & Trim(rs(77)) & "','" & Trim(rs(78)) & "','" & Trim(rs(79)) & "','" & Trim(rs(80)) & "','" & Trim(rs(81)) & "')"
cmd.Execute

Plz help me out

Reply With Quote
  #2  
Old June 21st, 2005, 05:04 AM
asc11 asc11 is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: May 2005
Posts: 894 asc11 User rank is Sergeant Major (2000 - 5000 Reputation Level)asc11 User rank is Sergeant Major (2000 - 5000 Reputation Level)asc11 User rank is Sergeant Major (2000 - 5000 Reputation Level)asc11 User rank is Sergeant Major (2000 - 5000 Reputation Level)asc11 User rank is Sergeant Major (2000 - 5000 Reputation Level)asc11 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 5 h 23 m 4 sec
Reputation Power: 37
Thanks for the code but I don't think we can find the error in this. I don't think the error is not in your code, but in the SQL Statement you are building in your code. If you could, build the SQL Statement in a String variable and capture the value of the String variable. Post that value and we might be able to find something wrong.

Reply With Quote
  #3  
Old June 21st, 2005, 05:13 AM
avsunil avsunil is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 13 avsunil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 56 m 4 sec
Reputation Power: 0
runtime error in insert statement

hi

do one thing... place the insert statement in a string and try to print the string value..
by this u can find where the error lies in the insert query

Reply With Quote
  #4  
Old June 21st, 2005, 05:21 AM
hithere's Avatar
hithere hithere is offline
Learner
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: India
Posts: 450 hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 12 h 13 m 21 sec
Reputation Power: 17
This is my query

insert into TradingDetails(nSL,nMarket,nATO,nFrozen,nModified, nTraded,nMatchedInd,nOrderNumber,nOrderTime,nEntry Time,nAuctionNumber,cParticipantType,nCompetitorPe riod,nSolicitorPeriod,cModCancelBy,nReasonCode,cSe curitySuspendIndicator,nDisclosedQuantityRemaining ,nTotalQuantityRemaining,nQuantityTraded,nQuantity TradedToday,nQuantityRemaining,nTradedPrice,nTrade No,nTradedTime,nBranchID,sBrokerID,nTokenNumber,cO penClose,cCoverUncover)values('0','0','0','0','0', '0','0','0',' ','2005-06-16 10:15:15 AM','0','','0','0','','0','',0,675,,0,,,' ','','8224','','21786','O','V')

Reply With Quote
  #5  
Old June 21st, 2005, 05:25 AM
avsunil avsunil is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 13 avsunil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 56 m 4 sec
Reputation Power: 0
yeh now u try to run this query in the query analyser and see.. I think their are spaces problem in the query.. once execute the query in query analyser and check

Reply With Quote
  #6  
Old June 21st, 2005, 05:31 AM
hithere's Avatar
hithere hithere is offline
Learner
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: India
Posts: 450 hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 12 h 13 m 21 sec
Reputation Power: 17
hey i have solved the problem.it was becuase of that continuous commas in the insert statement.

Thnx for ur help

Reply With Quote
  #7  
Old June 21st, 2005, 05:33 AM
avsunil avsunil is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 13 avsunil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 56 m 4 sec
Reputation Power: 0
great

have a nice day

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > runtime error in insert statement


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