한 번에 둘 이상의 SQL 명령을 실행하는 방법을 알고 싶습니다.C에서 두 줄 이상으로 SQL 명령을 실행하는 방법
using (SqlConnection sqlConnection1 = new SqlConnection(connectionString))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT nome FROM teste";
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlConnection1;
sqlConnection1.Open();
// execute the command
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
listBox1.Items.Add(rdr["name"].ToString());
}
}
}
을하지만 어떻게 내 C# 프로그램에서
use [databaseX]
SELECT nome FROM teste
을 실행하기 위해 할 수있는이 순간
나는 이런 식으로 일을 해요?
해당 행을 실행할 필요가 없습니다. 당신은 당신의 connectionString에 사용할 데이터베이스를 설정할 수있다. –