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.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Development Tools
 Other Development Tools
 Data existing in table, but showing as "NULL"
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

2 Posts

Posted - 08/06/2014 :  03:10:13  Show Profile  Reply with Quote

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
Flowing Fount of Yak Knowledge

1834 Posts

Posted - 08/06/2014 :  10:55:05  Show Profile  Reply with Quote
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 - 08/07/2014 :  09:09:24  Show Profile  Reply with Quote
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. :)

Edited by - Irinushk on 08/07/2014 09:09:50
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000