473,382 Members | 1,651 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

"Incorrect syntax near" problems

Hi Everyone,
I'm having a slight problem, I hope I didn't overlook something. I'm getting
the following error when I try to execute the function below:
Incorrect syntax near 'intake_GetListSet'."

Private sub LoadListSet()
dim da as New SqlDataAdapter
Dim cmd as New SqlCommand
try
cmd.Connection = OpenConnection()
cmd.CommandType = CommandType.Text
cmd.CommandText = "intake_GetListSet"
cmd.Parameters.Add("@PatientId",SqlDbType.VarChar , 20).Value = fPatientId
da.SelectCommand = cmd
ListSet.Clear
da.Fill(ListSet) >>>> Errors here.
Catch ex As Exception
msgbox(ex.Message )
finally
cmd.Connection.Dispose
da.Dispose
End Try
End Sub
The Stored proc follows.

CREATE PROCEDURE [dbo].[intake_GetListSet]
@PatientId varchar(20)
AS

SELECT List.KeyId, List.PatientId, List.ExamId, List.TypeId,
ListTypes.TypeName, List.ListType
FROM (PhysicalExamination LEFT JOIN Medeator
ON PhysicalExamination.KeyId = Medeator.ExamId)
LEFT JOIN (List LEFT JOIN ListTypes ON List.TypeId = ListTypes.TypeId) ON
Medeator.ForeignKeyId = List.KeyId
Where List.PatientId = @PatientId
GO

In SQL Enterprise Manager the stored proc works just fine. It only seens to
error in the code above. fPatientId does have a valid value. Does anyone have
an idea whats going on. Thanks for any help.
Michael

Jan 4 '06 #1
3 2851
Hi,

You are calling a stored procedure so your command type is stored
procedure.

cmd.CommandType = CommandType.StoredProcedure

Ken
-------------------
"Michael" <Mi*****@discussions.microsoft.com> wrote in message
news:71**********************************@microsof t.com...
Hi Everyone,
I'm having a slight problem, I hope I didn't overlook something. I'm
getting
the following error when I try to execute the function below:
Incorrect syntax near 'intake_GetListSet'."

Private sub LoadListSet()
dim da as New SqlDataAdapter
Dim cmd as New SqlCommand
try
cmd.Connection = OpenConnection()
cmd.CommandType = CommandType.Text
cmd.CommandText = "intake_GetListSet"
cmd.Parameters.Add("@PatientId",SqlDbType.VarChar , 20).Value =
fPatientId
da.SelectCommand = cmd
ListSet.Clear
da.Fill(ListSet) >>>> Errors here.
Catch ex As Exception
msgbox(ex.Message )
finally
cmd.Connection.Dispose
da.Dispose
End Try
End Sub
The Stored proc follows.

CREATE PROCEDURE [dbo].[intake_GetListSet]
@PatientId varchar(20)
AS

SELECT List.KeyId, List.PatientId, List.ExamId, List.TypeId,
ListTypes.TypeName, List.ListType
FROM (PhysicalExamination LEFT JOIN Medeator
ON PhysicalExamination.KeyId = Medeator.ExamId)
LEFT JOIN (List LEFT JOIN ListTypes ON List.TypeId = ListTypes.TypeId) ON
Medeator.ForeignKeyId = List.KeyId
Where List.PatientId = @PatientId
GO

In SQL Enterprise Manager the stored proc works just fine. It only seens
to
error in the code above. fPatientId does have a valid value. Does anyone
have
an idea whats going on. Thanks for any help.
Michael

Jan 4 '06 #2
Michael wrote:
Hi Everyone,
I'm having a slight problem, I hope I didn't overlook something. I'm getting
the following error when I try to execute the function below:
Incorrect syntax near 'intake_GetListSet'."

Private sub LoadListSet()
dim da as New SqlDataAdapter
Dim cmd as New SqlCommand
try
cmd.Connection = OpenConnection()
cmd.CommandType = CommandType.Text
cmd.CommandText = "intake_GetListSet"
cmd.Parameters.Add("@PatientId",SqlDbType.VarChar , 20).Value = fPatientId
da.SelectCommand = cmd
ListSet.Clear
da.Fill(ListSet) >>>> Errors here.
Catch ex As Exception
msgbox(ex.Message )
finally
cmd.Connection.Dispose
da.Dispose
End Try
End Sub
The Stored proc follows.

CREATE PROCEDURE [dbo].[intake_GetListSet]
@PatientId varchar(20)
AS

SELECT List.KeyId, List.PatientId, List.ExamId, List.TypeId,
ListTypes.TypeName, List.ListType
FROM (PhysicalExamination LEFT JOIN Medeator
ON PhysicalExamination.KeyId = Medeator.ExamId)
LEFT JOIN (List LEFT JOIN ListTypes ON List.TypeId = ListTypes.TypeId) ON
Medeator.ForeignKeyId = List.KeyId
Where List.PatientId = @PatientId
GO

In SQL Enterprise Manager the stored proc works just fine. It only seens to
error in the code above. fPatientId does have a valid value. Does anyone have
an idea whats going on. Thanks for any help.
Michael


Yes you overlooked something simple....

cmd.CommandType = CommandType.Text

Should be:

cmd.CommandType = CommandType.StoredProcedure

Have a good one...
Chris
Jan 4 '06 #3
Hi Chris,
Just shoot me now. My gosh, how could I have missed that. Sorry about that
you all.
Thanks again.
Michael
"Chris" wrote:
Michael wrote:
Hi Everyone,
I'm having a slight problem, I hope I didn't overlook something. I'm getting
the following error when I try to execute the function below:
Incorrect syntax near 'intake_GetListSet'."

Private sub LoadListSet()
dim da as New SqlDataAdapter
Dim cmd as New SqlCommand
try
cmd.Connection = OpenConnection()
cmd.CommandType = CommandType.Text
cmd.CommandText = "intake_GetListSet"
cmd.Parameters.Add("@PatientId",SqlDbType.VarChar , 20).Value = fPatientId
da.SelectCommand = cmd
ListSet.Clear
da.Fill(ListSet) >>>> Errors here.
Catch ex As Exception
msgbox(ex.Message )
finally
cmd.Connection.Dispose
da.Dispose
End Try
End Sub
The Stored proc follows.

CREATE PROCEDURE [dbo].[intake_GetListSet]
@PatientId varchar(20)
AS

SELECT List.KeyId, List.PatientId, List.ExamId, List.TypeId,
ListTypes.TypeName, List.ListType
FROM (PhysicalExamination LEFT JOIN Medeator
ON PhysicalExamination.KeyId = Medeator.ExamId)
LEFT JOIN (List LEFT JOIN ListTypes ON List.TypeId = ListTypes.TypeId) ON
Medeator.ForeignKeyId = List.KeyId
Where List.PatientId = @PatientId
GO

In SQL Enterprise Manager the stored proc works just fine. It only seens to
error in the code above. fPatientId does have a valid value. Does anyone have
an idea whats going on. Thanks for any help.
Michael


Yes you overlooked something simple....

cmd.CommandType = CommandType.Text

Should be:

cmd.CommandType = CommandType.StoredProcedure

Have a good one...
Chris

Jan 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Michelle Kinsey-Clinton | last post by:
Hello, I am writing an ASP app which is giving me some very frustrating errors. They appear intermittently, no real pattern to them, and often go away if you reload, or back up a few pages and...
5
by: J. Muenchbourg | last post by:
IN the code below, I am getting an Incorrect Syntax near "," error (the sql execute line, and it is pointing to position 1 ) (the display formatting here may look different than my script): ...
1
by: Marc | last post by:
I'm trying to execute a query in a postgresql database when the following message displays: State: S1000 Code: 7 Message: ERROR: parser: parse error at or near "." Regs. Marc Oost
4
by: metaperl | last post by:
I work at a place which is currently running SQL 2000, but they are planning to migrate to 2k5. I was thinking that this is the perfect opportunity to fix all the weaknesses we have had in our data...
5
by: Lloyd Dupont | last post by:
Hi All! I have this application of mine which works well. It even used to work on Vista. (I work on XP most of the time). There are some ManagedC++ assemblies in the project. Now when I try...
1
by: itamar82 | last post by:
I am getting the following error: Microsoft OLE DB Provider for SQL Server error '80040e14' Incorrect syntax near the keyword 'WHERE'. for the sql below: SELECT TourId FROM (SELECT...
3
by: eros | last post by:
ALTER TABLE public.postcodes ALTER COLUMN machi TYPE varchar(100); Error: ERROR: syntax error at or near "TYPE"; Error while executing the query (State:42601, Native Code: 7) I am using...
7
by: luttkens | last post by:
I used to have no problems using IF-statement in SQL-queries. Now nothing works, it always returns "Syntax error". This query also returns an error. IF (1=1) THEN SELECT 'True' ELSE SELECT...
0
kmartinenko
by: kmartinenko | last post by:
Hello, I am wondering if there is a sly workaround in ArcGIS 9.2 where I can write a "near" analysis script in Python and create my own tool for the purpose of identifying the distance values...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.