Java
while creation atable in sql server db i have the following eror
this is my code
try
{
string str="server=(local);database=test;integrated security = sspi ";
SqlConnection sc=new SqlConnection();
sc.ConnectionString=str;
SqlCommand smd=new SqlCommand();
smd.CommandText="create table " + textBox1 .Text + "(dd int not null , ss nvarchar(10)) ";
smd.Connection=sc;
sc.Open();
string x= smd.ExecuteNonQuery().ToString();
if(x!=null )
{
MessageBox.Show("1");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}the error is the following
object reference not set to an instance object
please help me
Answers
Know the answer? Post it. Somebody with the same question will find it here.