i want to concateneate my query with textfield value


select tablename.columnname From TableName

lyk this

Select tablename. & Me.textfield.text & from tablename

plz tell me where m i doing wrong

actually i m trying to only select single column by combo box.whenever combo box value is equal to column name
plz help me out..

You need to create a variable to hold the command and build it. Then you can use the exec function to execute the variable:

declare @sql varchar(200)
select @sql = 'select tablename.' & @myColumnName & ' from tablename'
exec @sql

Please note that this is not a full procedure, you'll have to supply the missing create and parameter value.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.