Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasesRight now I'm filling my dataset by adding a query to my tableadapter and filling by a specific field value in my ADO.net program. I would also like to come up with some way to replace the Specific Field "Desk" in my code and place a variable in there that can be replaced with anything. Select * from DataTable Where (Desk = @DeskValue) ' and I name this query works great. Select * from DataTable Where (@Field = @Value) 'This doesn't work for me, but want to know if there is another way to do this?
Post Follow-up to this messagemike Since I don't know your business logic behind it , I can only guess declare @sql nvarchar(1000), @col sysname, @orderid int select @col='OrderID', @orderid=10248 set @sql = 'select * from Northwind..Orders where '+@col+'= @ordid' exec sp_executesql @sql, N'@ordid int',@orderid "mike11d11" <mike11d11@yahoo.com> wrote in message news:1165985467.864390.301360@80g2000cwy.googlegroups.com... > Right now I'm filling my dataset by adding a query to my tableadapter > and filling by a specific field value in my ADO.net program. I would > also like to come up with some way to replace the Specific Field "Desk" > in my code and place a variable in there that can be replaced with > anything. > > Select * from DataTable Where (Desk = @DeskValue) ' and I name this > query works great. > > Select * from DataTable Where (@Field = @Value) 'This doesn't work for > me, but want to know if there is another way to do this? >
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread