i create sql database and table at runtime but i have some errors there are given below
this is for create bd:-
conn.Open();
string sql = "CREATE DATABASE mydb ON PRIMARY"+"(Name=test_data, filename = 'C:\\mysql\\mydb_data.mdf', size=3,"+"maxsize=5, filegrowth=10%)log on"+"(name=mydbb_log, filename='C:\\mysql\\mydb_log.ldf',size=3,"+"maxsize=20,filegrowth=1)" ; SqlCommand cmd = new SqlCommand(sql, conn);
try
{
cmd.ExecuteNonQuery();
}
conn.Close();
above create db code i got error invalid name ,i want to create db and mdf and ldf files
plz verift the sql string and post me correct code
this is for create table:
----------------------------
SqlConnection
con.Open();
//"(myId INTEGER CONSTRAINT PKeyMyId PRIMARY KEY," +
//"myName CHAR(50), myAddress CHAR(255), myBalance FLOAT)";
con.Close();
in create table code i want create table given in textbox(mytable),when click create table button
the table not created i got invalid table name error
plz help me...