Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 sql statement in .net

Author  Topic 

amitbadgi
Starting Member

29 Posts

Posted - 2005-08-12 : 01:43:06
Can any one let me know if this sql statement is right, i am using it in a vb.net project,

Dim sql = " select "& fieldname &" from "& tablename &" where "&criteriafield&" = " & criteriavalue

It says end of statement expected. Thanx in advance

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-12 : 02:19:58
What is the value of sql after that statement?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2005-08-12 : 07:13:01
it is expecting something like this:

DIM sql as string = "my totaly wrong way of accessing my SQL server that is so unsecure that i should go for a long walk"

If you MUST use in-line SQL statements and build them dynamicaly (and you dont have to), then do it this way:
DIM SQL as New System.Text.StringBuilder
SQL.Append("string here")
SQL.Append("more bad coding here")

Then you can get the whole thing by calling SQL.ToString()


Help us help YOU!
Read this blog entry for more details: http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx

*need more coffee*
SELECT * FROM Users WHERE CLUE > 0
(0 row(s) affected)
Go to Top of Page
   

- Advertisement -