sasa sasa

sasa sasa

  • NA
  • 2
  • 0

eror in creation atable by using c#.net

Aug 26 2008 8:56 AM

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