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
senthil
NA
27
0
Problem in creating table at runtime in c#.. Plz Help Dear ones... URGENT
Nov 15 2009 11:52 AM
I have a three
textbox
in my form and a button
one to table name ( Example .Emp details)
two to get field name(Example ID)
three to get field value(Example 10)
i need a code to pass values in run time and all should be stored in SQL
i dont know code but plz Help me.. im getting Error..
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con=new SqlConnection("Data Source=localhost;Initial Catalog=Northwind;User Id=sa;Password=sa");
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM "+ TextBox1.Text +"",con);
SqlCommand CMD = new SqlCommand("Create table "+ TextBox1.Text +"("+ TextBox2.Text +" )values( '"+ TextBox3.Text +"')",con);
DataSet ds = new DataSet();
da.Fill(ds,"+ TextBox1.Text +");
DataGrid1.DataSource=ds;
DataGrid1.DataMember="+ TextBox1.Text +";
DataGrid1.DataBind();
con.Open();
CMD.ExecuteNonQuery();
con.Close();
}
Please dear friend Help me soon
If any doubt mail me at
[email protected]
Thank u
senthil kumar.
Reply
Answers (
9
)
Log in probelm
problem with my login page