Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why I can store Null value in SQL tables?

Status
Not open for further replies.

Vincentan

MIS
Aug 21, 2002
52
MY
Hello an have a good days for all expertised!
I need your help and advise for my VB6 & SQL 7.0 and I suing ADODB, recently I can't store and display a Null value in my SQL database, my example code is:

txtPartCode = rsc!Part_Code
txtPartDescrip = rsc!Part_Description

the rsc = recordset from a table from SQL and the Part_Description is a table field which content null value, I can store this and display in my VB application as text box! Can any expertise advise! :)

What is the best way of showing record in a VB form? by calling customised display sub function or other any method?
 
You can use the IIF and the isnull function to determine what to place in the text box if the value is null.

txtPartCode = iif(isnull(rsc!Part_Code),"",rsc!Part_Code)
txtPartDescrip = iif(isnull(rsc!Part_Description),"",rsc!Part_Description)


Thanks and Good Luck!

zemp
 
Hey zemp! thanks a lot for your help! I have another question maybe need your help!

I had create a recordset to collect some record from a table in SQL and how to create a button to popup a datagrid for allow to select the record and return it to the form?

how to return the value from the datagrid form and display it in the form? Thanks!
 
I would place the datagrid on a second form. You can add a data control and bind it to your recordset (which may need to be passed to form2) and then bind the data control to the grid. Your button can open the second form.

You will need some way of keeping track of a key value so you can find the selected record again. Either in a public variable of form1 or a global variable. You can use the grids click event and row and column properties to determine this key value.

Upon returning to form1 you can search through the existing recordset (if it still exists) for the record that was selected and display it in the form.

Thanks and Good Luck!

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top