Kiểm tra giá trị NULL trong câu lệnh MySQL


Câu lệnh (sử dụng IS NULL):

using MySql.Data.MySqlClient;
using System;
public void KIEMTRAGIATRINULL()
{
MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection();
MySql.Data.MySqlClient.MySqlCommand comm;
MySql.Data.MySqlClient.MySqlDataReader dr;
System.Data.DataSet ds;
conn.ConnectionString = "server = 127.0.0.1; uid = admin; pwd = 12345689; database = skydoc; charset = utf8;";
conn.Open();
comm = new MySql.Data.MySqlClient.MySqlCommand("SELECT * FROM khachhang WHERE diachicongty IS NULL", conn);
dr = comm.ExecuteReader();
ds = new DataSet();
DataTable dataTable = new DataTable();
ds.Tables.Add(dataTable);
ds.EnforceConstraints = false;
dataTable.Load(dr);
//...
}

Copy »


Keywords: Kiểm tra giá trị NULL trong câu lệnh MySQL

TOP