|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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 |
|
#2
|
|||
|
|||
|
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.
|
|
#3
|
|||
|
|||
|
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 |
|
#4
|
||||
|
||||
|
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') |
|
#5
|
|||
|
|||
|
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
|
|
#6
|
||||
|
||||
|
hey i have solved the problem.it was becuase of that continuous commas in the insert statement.
Thnx for ur help |
|
#7
|
|||
|
|||
|
great
have a nice day |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > runtime error in insert statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|