SqlConnection cn;
cn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=J:\\Rcar\\motion\\db_image.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
if (cn.State==ConnectionState.Closed)
{
cn.Open();
}
SqlCommand cmd;
string sq1;
sq1 = "CREATE TABLE [B]"+TextBox1.Text+"[/B](myId INTEGER CONSTRAINT PKeyMyId PRIMARY KEY," +"myName CHAR(50), myAddress CHAR(255), myBalance FLOAT)";
cmd = new SqlCommand(sq1, cn);
try
{
cmd.ExecuteNonQuery();
MessageBox.Show("Table Created");
}
catch (SqlException sqlexception)
{
MessageBox.Show(sqlexception.Message, "Oh Fudge.",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Fooey.", MessageBoxButtons.OK,MessageBoxIcon.Error);
}
finally
{
cn.Close();
}
}
IN THE ABOVE CODE CAN CREATE THE TextBox1.Text VALUE AS THE NEW TABLE........
CAN ANYONE TELL ME WHAT'S THE PROBLEM