원격 mysql 데이터베이스에 레코드를 추가하고 그 후에 추가되었는지 확인하고 싶습니다. 그래서이 특정 레코드를 선택하려고합니다.C# .net winforms로 mysql 데이터베이스에서 선택 - 응답을 확인하는 방법?
내 코드 :
public void Select(string filename)
{
string query = "SELECT * FROM banners WHERE file = '"+filename+"'";
//open connection
if (this.OpenConnection() == true)
{
//create command and assign the query and connection from the constructor
MySqlCommand cmd = new MySqlCommand(query, connection);
//Execute command
cmd.ExecuteNonQuery();
//close connection
this.CloseConnection();
}
}
방법 서버의 응답을 확인하는? 또는 선택한 레코드? C# windows forms 앱입니다.
당신은 SqlDataReader 개체 또는 SqlDataAdapter를하여 하나의 데이터로 가득 할 DataTable을 사용할 수 있습니다. 이제 datatable 객체에 대한 rowcount 만 확인하십시오. –
파일 이름이 새로 추가 된 레코드입니까? –