Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
5
Reply
create table dynamically using asp.net C#
Anita Srivastav
Nov 23 2013 7:49 AM
4k
Reply
I WANT TO CREATE A NEW TABLE IN AN EXISTING DATABASE.
WHEN MY WEBSITE USERS CICK A BUTTON A NEW TABLE IN MY EXISTING DATABASE SHOULD BE CREATED.
I USE THE BELLOW CODE BUT IT DOES NOT WORKS AND NO NEW TABLE IS CREATING.
PLEASE SUGGEST ME IF I AM WRONG SOMEWHERE.
THANK YOU
I AM USING THIS CODE IN BUTTON CLICK EVENT
protected void Button7_Click(object sender, EventArgs e)
{
string cs = WebConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString;
SqlConnection con = new SqlConnection(cs);
string sqlStatement = "CREATE TABLE dbo.prince (stuname CHAR(50), stuaddress CHAR(255), stubalance FLOAT)";
SqlCommand sqlCmd = new SqlCommand(sqlStatement, con);
sqlCmd.ExecuteNonQuery();
con.Close();
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
5
)
Next Recommended Forum
how potentiall dangerous request page values detected
Unable to access port at sending sms