timothy2l Posted July 21, 2003 Posted July 21, 2003 Can someone tell me the correct syntax for the following SQL statement using C#? SELECT COURSESNEEDED.CourseNumber, COURSESNEEDED.CourseName, COURSESNEEDED.CreditHours, REQUISITE.CourseName, REQUISITE.ReqType FROM COURSESNEEDED, REQUISITE WHERE COURSESNEEDED.CourseName = REQUISITE.CourseName AND COURSESNEEDED.CourseNumber < 2000 AND REQUISITE.ReqType = 'Prerequisite' Thanks in advance. Quote
*Experts* mutant Posted July 21, 2003 *Experts* Posted July 21, 2003 Why would you want to convert it to C#? I have never seen a database that uses C# syntax for SQL. Quote
timothy2l Posted July 21, 2003 Author Posted July 21, 2003 Sorry for the confusion. I wasn't sure if the syntax would be different when typing the SQL statement in the cs code. Ex. sqlString = "SELECT * FROM Table1"; I wasn't sure if there would be any extra characters, etc. when querying multiple tables and having contraints. I guess it makes sense that it wouldn't change. Quote
*Experts* mutant Posted July 21, 2003 *Experts* Posted July 21, 2003 The only thing that could force to change the query is if you have code that you want to make DB independent, meaning that you want your application to run on a DB user choose, so you would need different queries for different DBs if they need to be different. But it still has to be written in SQL syntax. Quote
wyrd Posted July 21, 2003 Posted July 21, 2003 SQL is its own language, it has nothing to do with C# or any other language. Quote Gamer extraordinaire. Programmer wannabe.
jssk Posted July 24, 2003 Posted July 24, 2003 This is not about SQL syntax, but you need to escape the double quote character (") if you use a double quote in a SQL statement. For example, "SELECT \"last name\" FROM Person" Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.