怎么用C#取到select count(*) from master..sysdatabases where name in('PengclDB')的返回值做判断呢
怎么用C#取到select count(*) from master..sysdatabases where name in( 'PengclDB ')的返回值做判断呢 谁能给我一个小例子
------解决方案--------------------int.ret = (int)cmd.ExecuteScalar();
if(ret > 1)
{
}
------解决方案--------------------点击管理
给分之后 输入密码 确定
------解决方案--------------------string sql = "INSERT INTO Production.ProductCategory (Name) VALUES (@Name); "
+ "SELECT CAST(scope_identity() AS int) ";
SqlConnection conn = new SqlConnection(connString)
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.Parameters.Add( "@Name ", SqlDbType.VarChar);
cmd.Parameters[ "@name "].Value = newName;
try
{
conn.Open();
newProdID = (Int32)cmd.ExecuteScalar();
if(newProdID> 1)
{
}
}
catch (Exception ex)
{
}
finally
{
conn.Close();
}
------解决方案--------------------int RecordCount=(int)cmd.ExecuteScalar();