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
Anita Srivastav
NA
21
15k
create table dynamically using asp.net C#
Nov 23 2013 7:49 AM
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();
}
Reply
Answers (
5
)
how potentiall dangerous request page values detected
Unable to access port at sending sms