Goran Bibic

Goran Bibic

  • 482
  • 2.9k
  • 199.1k

Mysql data reader if is null field C#

Nov 2 2023 8:11 AM

MYsql data reader if is null field c#

If is null field need to be empty

Datum = rd.GetString("DATUM"),

this

I have error if is empty

<pre> koneksi.Open();
            var rd = cmd.ExecuteReader();
            users = new List<user>();
            while (rd.Read())
            {
                users.Add(new user
                {
                    
                     Datum = rd.GetString("DATUM"),
                                  
                 }
                    );
            }
            rd.Close();

 


Answers (4)