Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Data existing in table, but showing as "NULL"

Author  Topic 

Starting Member

2 Posts

Posted - 2014-08-06 : 03:10:13

I am new to SQL Servers ( overall programming and working with these devices :) ) and while I was working on such a device, I encountered a problem, that I couldn't solve no matter what.

I have to get certain data (i.e. a cell value) from a data table in a SQL Server. I connected to the Server using Visual Studio and as language, Visual Basic. I made queries to see where I can find that data. I found it and now I started to write code on which I pull out the data and show it on a form. The code is the following:

Dim cmd1 As New SqlCommand("My sql code here", Conn)
cmd1.CommandType = CommandType.Text
Dim dr1 As SqlDataReader = cmd1.ExecuteReader()

While dr1.Read()
If dr1.Item(0) IsNot DBNull.Value Then
Label10.Text = dr1.Item(0)
Label10.Text = "Data is not there"
End If
End While


Although I know that the data is entered in the database, exactly in what place, I do not understand why my application sees that cell as "NULL", stating "Data is not there" in the form.

Why does this happen? Can you please help me?

Thank you in advance.

The world always looks brighter from behind a smile. So smile. :)

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2014-08-06 : 10:55:05
What results do you get when you query the database directly, for instance, through Management Studio? How do you "know" that the data is entered?

Too often we enjoy the comfort of opinion without the discomfort of thought. - John F. Kennedy
Go to Top of Page

Starting Member

2 Posts

Posted - 2014-08-07 : 09:09:24
When I query the database directly through Management Studio, I get "NULL" for all the column cells, except one, that contains "98". My column should contain values like "code1" (so text and a number).

I know that the data is entered, because I entered it by an Application connected to the database.

The world always looks brighter from behind a smile. So smile. :)
Go to Top of Page

- Advertisement -