SEARCH YOUR SOLUTION HERE  

error message incorrect syntax

i keep on getting this error message incorrect syntax in line1... funny thing is when i execute every thing from SQL Query Analyzer it works just fine but when I'm executing the stored procedure from .net i keep on getting the errro message that I've mentioned above..
my sql stored procedure code snippet is given bellow
Code:
Generate PROCEDURE dbo.OracleStudentTbl
(
@tblName as varchar(255)
)
AS
DECLARE @SQL as varchar(8000)
DECLARE @tbl as varchar(255)
SET @tbl =@tblName
SET @SQL=
'INSERT INTO [dbo].['+@tbl+']'
SELECT * FROM OPENQUERY(XXXX 'SELECT * FROM vw_student_details_forsurvey')
EXEC(@SQL)
GO
fundamentally what my stored procedure is doing is fetching a table name from my vb.net windows form then passing it to the stored procedure, then my SELECT * FROM OPENQUERY is populating the the table with its info... but as i mentioned i receive the syntax error...my code in my command button on vb.net is given bellow
Code:
Private Sub butSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butSave.Click
Dim varDetails As String = txtDetails.Text + "_" + txtDetailsTblName.Text
Dim sqlCommandDetailsInsert As New SqlCommand("OracleStudentTbl", connStr)
sqlCommandDetailsInsert.CommandType = CommandType.StoredProcedure
connStr.Open()
'this command is sending to the stored procedure the table name for the Students Details Table so that
'student details table will be populated with the data from the Oracle See
sqlCommandDetailsInsert.Parameters.add("@tblName", varDetails)
Try
sqlCommandDetailsInsert.ExecuteNonQuery() ' receive error here when I'm debbuging my windows forms
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Info, "ErrorIn Code")
EXIT Try
End Try
Dim frmMain As New frmMain
frmMain.mySQLname = var
frmMain.Display()
Me.Close()
End Sub
would applaud assist pls..
Posted On: Monday, November 12, 2012 Total Views: 4
View Complete with Replies




Related Messages:

Insert into syntax error?  (5 Views)
It' mercattor again bringing a brand-new error message;
Just for a conscience cleanse: Do u view any wrong statements in this scrap of code snippet:
Code:
, if rs=Server.CreateObject("ADODB.Recordset"), conn is defined by a .inc file, given bellow:
Code:
and art_(num,author and name) various text-based strings
Because the error is:
Microsoft OLE Database Provider for ODBC Drivers (0x80040E14)
[Microsoft][Driver ODBC MS access] Syntax error in INSERT INTO instructions. (...), line 23 (bold line).
Any assistance will be extremely comprehended
View Replies !
Stored procedure error -scalar variable  (2 Views)

I have generated a SP as given below, How do I pass the output of SP to a varaible x
dim x
dim sql
dim oRS
set sql = "exec [usp_totalusers] '" & dt1 & "','" & dt2 & "'"
oRS = dbname.Execute sql
x = oRS("total_user")
I do not view any value passed to x. What could be wrong
Thanks in advance
Generate PROCEDURE [usp_totalusers]
(
@dt1 datetime,
@dt2 datetime
)
AS
BEGIN
SET NOCOUNT ON
select COALESCE(count(optindate),0) as total_user
from table_A
where datediff(day,@dt1,optdate) >= 0 and
datediff(day,@dt2,optdate) return
SET NOCOUNT OFF
END
View Replies !
sql query error  (4 Views)
I've a table that hold students info name STUDENTDATA I've another table named SURVEYANSWERS that holds answer from a survey the student fills out.. fundamentally the STUDENTDATA table has a PK (which is studentid) whilst the survey SURVEYANSWERS table has a FK (which is survey table).
I've added them both together and generated a see now bascially what i have to do is calculate the SUM of each column grouping by a certain column name..
my sql statement which I'm adding is given bellow but it tells me wrong syntaxCode snippet:
SELECT * FROM v_StudentDataAndSurvey Group By Mode
but as i told i receive an error message.. can somebody pls assist
View Replies !
Page Audit error attaching database  (2 Views)
I've a client whose HW dealer formatted their drive to clean off a virus. Tdidn't have any valid backkups of their SQL data. We've managed to excerpt the mdf and ldf files from the drive but receive the error message on attempts to attach the db to a reinstalled copy of MSDE: "Msg 5172 Level 16, State 15, Server STRUCTURE OSLER, Line 1
The header for file 'c: program Files Microsoft SQL
Server MSSQL$OSLER Data practicemanager.mdf' isn't a valid db file
header. The PageAudit property is incorrect."
The MSDE versions are the same from the original to the new server.
Is there a way to salvage this data
View Replies !
Where's my error in this statement?  (6 Views)
SELECT table1.* table2.Name, table3.MaintenanceID FROM table1INNER JOIN table2 ON table1.MachineID = table2.ID
LEFT JOIN table3 ON table1.SheetID = table3.ID
ORDER BY table2.Name

It works just fine with out the LEFT JOIN, but as soon as I add that clause in I receive the following error message:Microsoft JET Db Engine error '80040e14'
Syntax error (missing operator) in query expression 'table1.MachineID = table2.ID LEFT JOIN table3 ON table1.SheetID = table3.ID'.
If somebody could point out my mistake I would applaud it.

Spara
View Replies !
must use an updateable query error  (4 Views)
Error message Type:
Microsoft JET Db Engine (0x80004005)
Operation must use an updateable query.
okl common timeupdate.asp line 15





Hours = Request.form("Hours")
Mins = Request.form("Mins")
Secs = request.form("Secs")



strSQL = "Edit Timer SET Hrs=" & Hours & ",Mins=" & Mins & ",Secs=" & Secs & " WHERE studentID ='" & Session("StudID") & "'"
response.write strSQL
response.end
objConn.Execute (strSQL)

objConn.close
set objConn = Nothing
>

Edit Timer SET Hrs=1,Mins=59,Secs=59 WHERE studentID ='024053j'

db fields type : Number, long integer
View Replies !
Multiple-step error message  (6 Views)
Basically placed by : Robert Ramos (Robert.Ramos@DRMCI.ORG)I am just learning ASP and I have come across an SQL server error that I can't find to determine how can i resolve my Program. The error is 'Microsoft OLE Database Provider for SQL Server error 80040e21. Multiple-step OLE Database operation created bugs. Check each OLE Database status value if available. No work was done.' All I am attempting to do is add a new record using ADDNEW to a file. Any assistance would be comprehended.
View Replies !
Help w SQL statement syntax error  (3 Views)
Here's my SQL statement:
rs_totals.Source = "SELECT SUM (missed_sla_calls) as "total_calls" FROM missed_sla WHERE date_submit B/w #" & request.form("from_date") & "# AND #" & request.form("to_date") & "#"
And just in case its way off Here's what I'm Attempting to receive the sum of my missed_sla_calls column from my missed_sla table where the dates are b/w the two dates submitted by a user's input on a form.
I have the statement working just fine if i interchange SUM (missed_sla_calls) as "total_calls" with *, it will receive all the data, and work correctly. When I put the SUM statement in, I received a syntax error message when loading the page:
Expected end of statement
psc reports missed_sla_log.asp, line 23, column 54
line 23 is my SQL statement.
Any assistance
Marcus
View Replies !
Help needed with error '80040e57'  (3 Views)
I've the following edit. I know the error message is pertaining to fields shiftbegin and shiftend- I tested edit and it worked with out these 2 fields. Tare updating an access db with field type medium time. I've tried delimiting # and several other attempts and nothing is working. Can anybody provide me an example of updating an access db time only (not date and time) field
rs.Open SQL my_Conn
SQL = "Edit schedule SET shift_dte = '" & Request.Form("dte") & _
"' ,shiftPerson = '"& Request.Form("pname") & _
", Category =" & Request.Form("cathid") &_
" shiftID =" & Request.Form("shiftsel") & _
", shiftBegin = " & Request.Form("sftbeg") &_
", shiftEnd = " & Request.Form("sftend") & _
"' WHERE id = " & Request.Form("ID")

my_conn.Execute SQL
Microsoft JET Db Engine error '80040e57'
The field is too small to accept the amount of data u attempted to add. Try inserting or pasting less data.
View Replies !
Database login error  (6 Views)
Basically placed by : nick (nick@steenken.co.uk)I am a newcomer to databases but I've setup an Access db executing under IIS on my PC, and every thing works OK. My web hosting company uses MYSQL, so I downloaded and installed MyODBC 3.51, set up my connection and more to talk to my MYSQL db with my hosting companys server, tested my connection to the db, that was OK. Exported the Access table to MYSQL.Hosting companys server is UNIX, executing Chili soft ASP Version 3.5.2.31 and uses a DSNless connection to the MYSQL db.Configured my db path in my strings.inc file with info provided by hosting company.When I try and log into the db, I receive the following error:ADODB.Connection.1 error '800a0bb9' The software is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another. common.asp, line 39 Line 39 code snippet: adoCon.Open strConAny suggestions what the difficulty is
View Replies !
error  (2 Views)
Basically placed by : dimi (dieder@pandora.be)Microsoft OLE Database Provider for ODBC Drivers: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'DIEDERIKIUSR_DIEDERIK'.I always receive this error message when i try to connect to my msql server i use the local server with sa as uid.Conn.ActiveConnection = "Driver={SQL Server};server=(local);Uid=sa;Pwd=;Db=examen ;Trusted_Connection=Yes"any one who knows what could be the difficulty
View Replies !
Preventing error messages being presented  (5 Views)
Basically placed by : Karsten (edvsk@web.de)I am using the connection run property. If a run statement fails (i.E. stored procedure name is wrong) the error message is presented. How do I prevent this for creating my own error handler.
View Replies !
error in sql  (3 Views)
Basically placed by : stephen (profliz@hotmail.com)my coding:SQL1 = "SELECT m_id m_email, m_subject, m_numReplies, m_entrydate FROM messages "SQL2 = SQL1 & "WHERE m_reply=-1 ORDER BY m_id DESC;"set rs = Server.CreateObject("ADODB.Recordset")connectme="DSN=feedbackDSN"rs.Open SQL2,connectme ---> line 30error mesg provide :Microsoft OLE DB Provider for ODBC Drivers error '80040e10' [Microsoft][ODBC MS access Driver] Too few parameters. Expected 1. vote messagelist.asp, line 30 anybody have any solution what is wrong Pls assist
View Replies !
Database error trapping.  (2 Views)
Basically placed by : John (nozomi2310@excite.com)Does anyone have any solution how can i capture sql error message & then interchange it wif the error generated by asp so that user will know what it mean by the easy language instead of sql error.Thanx.Ur assist is comprehended.
View Replies !
Spread transaction error  (3 Views)
Basically placed by : sabu (sabu_p@usa.net) I encountered this difficulty when tried to perform a spread transaction using link server. My goal was to connect 2 data base servers using TCP IP and transfer data. I was able to execute single queries using "linkserver.catelog. owner.table". But this message was shown when i tried to execute a stored procedure. The message was "The operation could not be performed since OLEDB provider SQLOLEDB does not support spread transactions. [OLE Database spread transaction error message]" The documentations about the spread transactions showed that SQLOLEDB do support spread transactions. Pls forward ur valuable ideas.
View Replies !
bugs and stored procedures  (4 Views)
Basically placed by : Gulliver (gulliver@vi.is)I am working with stored procedures a set. Some of the storedprocedures are usingother stored procedures. When an error message occure I wana the name of the procedure that caused the errorto be returned with the line number where the error occured. Is this possible in SQL-Server
View Replies !
Query error  (1 Views)

I have this query and its gives me an error message saying expected end of statementwhere F Name and L Name are the names of the fields
the error is at " "Code snippet:
SELECT [F Name] & " " & [L Name] & [S Name] AS FullName from Students
View Replies !
Syntax error  (1 Views)
I'm attempting to execute a dbcc check on a db 'SHEDAT'. I've not ever done some thing like this but attempting to receive the syntax down.
View Replies !
Stored procedure error -scalar variable  (2 Views)

I receive this error "Must declare the scalar variable @LoginName ".. when I try to save this stored procedure.
I do not understand what is wrong. Thank u.
Code snippet:
Generate PROCEDURE dbo.StoredProcedure1
*
(
@LoginName nvarchar(25)
@LoginPass nvarchar(08)
)
*
AS
Select Log_name,users.userfName,users.UserLname from logins INNER JOIN
USERS on Logins.Log_Name=@LoginName
* SET NOCOUNT ON *
RETURN
View Replies !
Been awhile but Help Microsoft VBScript runtime error '800a01a8'  (8 Views)
I'm getting a
Microsoft VBScript runtime error message '800a01a8'
Object required: "
This is the sql statement Probably u can view what I can not
INSERT INTO Seminar ([thedate][city_state],[one],[2_or_more],[start],[end],[ce_info],[seatsavailble],[location],[seminarname],[AssociatedApprovCode],[trainingcode],[schedid]) VALUES ('Jan 6,2006','den co','50','50','4am','8:30pm','ce-001',150,'anywhere','this is a test','071806 01 ','071806 01 071806 0','006');
Microsoft VBScript runtime error '800a01a8'
Object required: '' the code is given bellow
strQ ="INSERT INTO Seminar ([thedate],[city_state],[one],[2_or_more],[start],[end],[ce_info],[seatsavailble],[location],[seminarname],[AssociatedApprovCode],[trainingcode],[schedid]) VALUES ('"&TheDate&"','"&City_state&"','"&singleP&"','"&t wo_or_more&"','"&start&"','"&endtime&"','"&Ce_info &"',"&seats&",'"&Location&"','"&SeminarName&"','"& AssociateApprovalCode&"','"&TrainingCode&"','"&Sch edID&"');"
View Replies !