• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 426
  • Last Modified:

Query problem in XSD in C#

Hey guys another problem.

The following code in a table adapter:
SELECT     MemberID, FirstName, Middle, LastName, RoleID, MemberStatusID, GoesByName, FamilyCode, WorkStatusID, EmployerID, UseFamilyAddress,
                      Address, Address2, City, State, ZipCode, HomePhone, HomeFaxPhone, HomeCellPhone, HomeEMail, WorkPhone, WorkFaxPhone, WorkCellPhone,
                      WorkEMail, MailLabelLine1, MailLabelLine2, OccupationID, Sex, Student, Retired, MemberShipDate, Anniversary, Birthday, BaptizedDate,
                      MaritalStatus, BloodType, ProjectedGraduationDate, InvolvementFormDate, Notes, LastUpdate
FROM         tblMember
WHERE  (FirstName LIKE @fname) ORDER BY LastName

gives errors of: Error in where clause near '@'
                         Error in where clause near 'ORDER'

I have the exact same type of query in another program that uses the same WHERE clause and it works perfectly.

Any help would be appreciated!!

Jerry
0
JDL129
Asked:
JDL129
  • 2
1 Solution
 
sameer_goyalCommented:
Are you providing the value to the parameter @fname in your C# code?

If yes, can you post how?
0
 
tigin44Commented:
SELECT     MemberID, FirstName, Middle, LastName, RoleID, MemberStatusID, GoesByName, FamilyCode, WorkStatusID, EmployerID, UseFamilyAddress,
                      Address, Address2, City, State, ZipCode, HomePhone, HomeFaxPhone, HomeCellPhone, HomeEMail, WorkPhone, WorkFaxPhone, WorkCellPhone,
                      WorkEMail, MailLabelLine1, MailLabelLine2, OccupationID, Sex, Student, Retired, MemberShipDate, Anniversary, Birthday, BaptizedDate,
                      MaritalStatus, BloodType, ProjectedGraduationDate, InvolvementFormDate, Notes, LastUpdate
FROM         tblMember
WHERE  FirstName LIKE '%' + @fname + '%'
ORDER BY LastName
0
 
JDL129Author Commented:
Thanks for the post guys!!
I might not have made this clear but the is a sql from a table adapter.  I have another program that my code works perfectly in but it seems that in this program I can't use a variable.  Is there some setting I'm missing?

Thanks guys!!

Jerry
0
 
JDL129Author Commented:
Thanks for the help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now