473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

VB.Net 2005 Null Error

Hello,
I need help.

I have problem for VB.Net 2005.
My backend database is SQL Server 2005

I wrote the following code:

strSQL="Select FName, LName, MName FROM tblInfo"
RsOpen(strSQL)
If Rs.RecordCount>0 Then
Rs.MoveFirst

txtFName.Text=Rs.Fields("FName").Value
txtMName.Text=Rs.Fields("MName").Value
txtLName.Text=Rs.Fields("LName").Value
End If

My problem is MName filed is null value. How can i check the null value?
I tried IsNull function in VB but in VB.Net there is no IsNull function.
Please anybody know the function for check IsNull ?

RaJaN
Oct 19 '07 #1
3 1455
semomaniz
210 Expert 100+
I think this will help you. I think in vb you will have to check for null value with the keyword nothing. The example is as follow

[code = vb.net]
Dim sTest As String
If (sTest Is Nothing) Then
Console.WriteLine("sTest is Null")
End If
[/code]

In you case i belive this should work,
Expand|Select|Wrap|Line Numbers
  1. if (Rs.Fields("MName").Value IS Nothing) then
     txtMName.Text = "The value is NULL"
    else
     txtMName.Text = Rs.Fields("MName").Value
    end if
  2.  
hope this helps.

semomaniz

Hello,
I need help.

I have problem for VB.Net 2005.
My backend database is SQL Server 2005

I wrote the following code:

strSQL="Select FName, LName, MName FROM tblInfo"
RsOpen(strSQL)
If Rs.RecordCount>0 Then
Rs.MoveFirst

txtFName.Text=Rs.Fields("FName").Value
txtMName.Text=Rs.Fields("MName").Value
txtLName.Text=Rs.Fields("LName").Value
End If

My problem is MName filed is null value. How can i check the null value?
I tried IsNull function in VB but in VB.Net there is no IsNull function.
Please anybody know the function for check IsNull ?

RaJaN
Oct 19 '07 #2
Shashi Sadasivan
1,435 Expert 1GB
what sort of data type is RS ?
Oct 19 '07 #3
You can use isDBNull(<FieldValue) to check for the NULL values.
Oct 19 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Steven | last post by:
I just downloaded the June 2005 release and I want to set up basic logging to log problems such as exceptions. I have created a category named Exceptions with the following: <category...
6
by: sathyashrayan | last post by:
Following are the selected thread from the date:30-jan-2005 to 31-jan-2005. I did not use any name because of the subject is important. You can get the original thread by typing the subject...
6
by: Brian Shafer | last post by:
Hello, I am VERY new to .Net and C#. But I have an app that I bought from a vendor with the source. This was written in C#2003. I have VS2005. I went through the upgrade process.. I have a...
10
by: WT | last post by:
Hello, I have been publishing my web site many times to the remote where resides my final web site. Everything was ok, but to-day, without any configuration change, vs doesn't copy final files...
0
by: mateipuiu | last post by:
When a try to run a client build on 2005, which uses the Microsoft.ApplicationBlocks.Cache.dll reference, when using a Microsoft.ApplicationBlocks.Cache.dll created on Debug mode, the client works...
3
by: Rico | last post by:
Hello, I have a foreign key constraint between two tables (Appointments and MissedAppointmentReasons) and I'd like to allow null values in Appointments table for the field containing the...
1
by: Ruth413 | last post by:
Hello - I am getting the these errors in my sql 2005 generated script. I am stuck with first error. Please help.... Msg 102, Level 15, State 1, Line 3 Incorrect syntax near '('. Msg 319,...
1
by: cnixuser | last post by:
Hello, I am having a problem that I believe is related to the way a stream reader object looks for a text file by default. What I am doing is using a StreamReader object to read the text of a text...
0
by: remya1000 | last post by:
i'm using VB.Net 2005 application program. i'm trying to convert VB6 code to VB.Net 2005. QSockB is DLL file. this is the code i used for VB6. This is code i'm using to create socket, when...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.