473,289 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

How to Append column name in SQL statement in .NET

Hi;
The problem is:

I get column name as a parameter . This parameter is "myColumnName".
Then I want to write such SQL statement :

"SELECT <myColumnName> FROM CUSTOMERS"

hovewer I dont know how to append myColumnName in sql statement..

Please help me.
Thanks in advance
Sincerly
Ozgur
Nov 22 '07 #1
1 1271
Expect that we have some input parameter string sColumnName.
So create the query string like this:

string sQuery = String.Format("select \"{0}\" from customers;", sColumnName)

or like this:

string sQuery = "select \"" + sColumnName + "\" from customers;";


Is this what you asked?

Z.

Hi;
The problem is:

I get column name as a parameter . This parameter is "myColumnName".
Then I want to write such SQL statement :

"SELECT <myColumnName> FROM CUSTOMERS"

hovewer I dont know how to append myColumnName in sql statement..

Please help me.
Thanks in advance
Sincerly
Ozgur
Nov 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Thomas Jerkins | last post by:
When I write a create table SQL statement I want to add some information about the column heading of each column. How does the exact syntax for the create table look like (which includes this column...
5
by: Barn Yard | last post by:
good morning, im still kind of new to VBA but I have learned some interesting things so far. Right now I am normalizing my survey database so I'm having to run an append query for each...
6
by: allyn44 | last post by:
Hi---I have to import some data from excel into an Access table--the code below is working ok but I would like to condense it by running a loop. The number of records can vary from 1 to 30 in each...
1
by: gtg974p | last post by:
Sub: Append a string to all the values in a column SQL Hi all, This might be a very simple query. But I am new to SQL programming. Hope someone can help me. I have a table --- 1634 ...
3
by: Darin | last post by:
This is something that on the surface seems like it should be simple, but I can't think of a way to do this. I have a table that is a list of "jobs", which users create and use. It has a single...
13
by: technocraze | last post by:
Hi guys, I have an issue with incrementing a counter in a table using VB in MS Acess environment. Below mentioned is an instance. Implementation logic Table fields Serialno = pk Datatype...
1
by: imauser | last post by:
I have a database(PostgreSQL) table(about 70k rows).I am developing an ASP webpage and there is a list-box on it which contains the name of the columns of that table. User selects the column name...
13
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I want to create a new column in a datatable from two existing columns. I have no problem to create the new column using the datatable.columns.add method. The problem is the value of the new...
7
by: wade.wall | last post by:
Hi all, I am having a problem appending data to an existing table. I have two tables with identical fields and I want to append the data from one table (T2) to the first (T1). T1 has 136...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.