m stuck wid a prob wherein i hv a table named book already in database created programatically from an xml file.now if sum1 cums wid another xml file havin a table book then the prog gives an error 'the table already exists in database'...
can i hv a method by which i cn chek if da table exists already by an sql query nd if it does can i drop it ..... i tried dis sql steps...
string strComand = "IF EXISTS (SELECT * FROM "+table.TableName+")";
SqlConnection cn;
cn=conn();
cn.Open();
SqlCommand mycommand= cn.CreateCommand();
mycommand.CommandText = strComand.ToString();
try
{
string strCommand;
if(table.Rows.Count>=0)
{
strCommand = "DROP TABLE"+table.TableName;
mycommand.CommandText = strCommand.ToString();
mycommand.ExecuteNonQuery();
cn sum1 help me out wid da sql query written in c# for da above prob, will it wrk 4 multiple tables in an xml file...lik book nd author already existing and it drops dem and creates new table....1 mr thing ..how 2 knw dat da existing table mathces wid da new table by da help of sum conditional statements...