0
好吧,我想获得的结果出来这个命令应该返回的东西谎言 (X)行受到影响 命令成功完成 print语句这里多个查询
我不知道如何获得在richtextbox..so的结果,如果有任何人能帮助我,这将是冷静
sqlconn.cnn = new SqlConnection("Data Source=.\\SQLEXPRESS" + ";Initial Catalog=" + shard.Text + ";User ID=" + textBox3.Text + ";Password=" + textBox4.Text);
sqlconn.cnn.Open();
SqlCommand cmd = new SqlCommand("DELETE FROM _SiegeFortress Where FortressID LIKE'%[1,3,6]%' INSERT INTO _SiegeFortress (FortressID,GuildID,TaxRatio,Tax,NPCHired,TempGuildID,Introduction,CreatedDungeonTime,CreatedDungeonCount,IntroductionModificationPermission) VALUES (1 ,0 ,0 ,0 ,0 ,0 ,NULL ,NULL ,0 ,1) INSERT INTO _SiegeFortress (FortressID,GuildID,TaxRatio,Tax,NPCHired,TempGuildID,Introduction,CreatedDungeonTime,CreatedDungeonCount,IntroductionModificationPermission) VALUES (3 ,0 ,0 ,0 ,0 ,0 ,NULL ,NULL ,0 ,1) INSERT INTO _SiegeFortress (FortressID,GuildID,TaxRatio,Tax,NPCHired,TempGuildID,Introduction,CreatedDungeonTime,CreatedDungeonCount,IntroductionModificationPermission) VALUES (6 ,0 ,0 ,0 ,0 ,0 ,NULL ,NULL ,0 ,1) PRINT 'fewfwef'", sqlconn.cnn);
cmd.Connection = sqlconn.cnn;
SqlDataReader crap;
try
{
crap = cmd.ExecuteReader();
crap.Close();
MessageBox.Show("Crap");
SqlDataReader name = cmd.ExecuteReader();
richTextBox1.Text = name.ToString();
name.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
有一个插入/ print语句 – ex0ff 2014-09-03 10:38:33
,当我使用的ExecuteNonQuery它返回一个int – ex0ff 2014-09-03 10:42:36
@KhaledMohamed什么是'print'说法? o.O是的'ExecuteNonQuery'返回'int',你可以象我一样将它转换为'string'。 – 2014-09-03 10:44:00