TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Yuvraj Jambhle
NA
93
8.4k
How to call Table name from combo box in sql command
Sep 26 2020 7:24 AM
I want to pool table name from the combo box in the SQL query. Below code, I use a static table name as "Logdata". For your reference, I attach the code.
Please guide me on how to call the selected table in the SQL query from the combo box.
Actually, I want to write the column name of the selected table in notepad.
public
void
getColumnName()
{
cmbFilterColumnName.Items.Clear();
SqlConnection columnCon =
new
SqlConnection(dbCon);
string
columnQuery = @
"Select Column_Name from information_Schema.Columns where Table_Name = 'Logdata'"
;
SqlCommand columnCmd =
new
SqlCommand(columnQuery, columnCon);
columnCon.Open();
SqlDataReader columnDr = columnCmd.ExecuteReader();
while
(columnDr.Read())
{
string
columnName = columnDr.GetString(0);
chkListBxColumnName.Items.Add(columnName);
}
columnCon.Close();
}
Reply
Answers (
2
)
How to integrate payment getway in asp.net mvc
How can I download a PDF file using URL without file name