|
-
May 6th, 2003, 08:34 AM
#1
Thread Starter
Sleep mode
-
May 6th, 2003, 09:14 AM
#2
Fanatic Member
are they empty strings or null values?
if they are empty strings do a strComp(string1, "") = 0 then don't do anything, or if it's null do if DBnull(string1) then don't do anything.
-
May 6th, 2003, 09:21 AM
#3
Thread Starter
Sleep mode
Yeah they are null values , I do know how to use DBNull.Value . How would you apply it here ?
-
May 6th, 2003, 09:27 AM
#4
Fanatic Member
not sure if i completely understand what you are doing but wouldn't it be better to just have 2 columns.
1 is the overall name, and the second the title e.g.
java : widgets
java : buttons
xml : stylesheets
vb : forms
java : stuff
then you can query the table putting java, xml, or vb in the where part.
-
May 6th, 2003, 09:38 AM
#5
Thread Starter
Sleep mode
I wanted it that way if possible . I'm sure it's but I can't go around it thought !
-
May 6th, 2003, 09:49 AM
#6
Fanatic Member
i mean that's how you need to design the database table. I pressume that's where you are getting the data from.
column1 : MainGouping
column2 : Title
design the table like that.
-
May 6th, 2003, 10:20 AM
#7
Thread Starter
Sleep mode
If I changed that then I would have to change lots of lines and rebuilding similar structure as you suggested doesn't neccessarily fits my situation thanks though !
-
May 6th, 2003, 10:36 AM
#8
Its the DB structure that creates the blank lines as nswan said. You can only delete a row at a time which then would remove the items that aren't blank in the same row as well. So there is no way without changing the structure as nswan suggested.
-
May 6th, 2003, 10:47 AM
#9
Fanatic Member
you could pull out an entire row though and then check for null values on each item in the datarow. Just trying to figure out how to check for nulls at the mo!
-
May 6th, 2003, 11:33 AM
#10
But how would you put the data back in for the rows that have half null and half not? To check for Null you can just use [fieldname] Is Null
-
May 6th, 2003, 11:52 AM
#11
Thread Starter
Sleep mode
nswan , that would take more time and won't help I guess .
I can remove them from combobox (I did actually but I don't want even to include them in the dataset )
This is how I populate a combobox with all records in a column , How can I use Is Null operator in this case Edneeis ?
VB Code:
Public Shared Sub ShowRecords(ByVal ComBox As ComboBox, ByVal TableStr As String, ByVal ColumnStr As String)
OpenDB()
Dim adoTables As New OleDb.OleDbCommand("Select * From " & TableStr & "", MyConnection)
Dim adoReader As OleDb.OleDbDataReader
Dim strTable As String
ComBox.Items.Clear()
Try
adoReader = adoTables.ExecuteReader()
While (adoReader.Read)
strTable = adoReader.Item(ColumnStr).ToString
ComBox.Items.Add(strTable)
End While
Catch myException As Exception
MessageBox.Show(myException.ToString())
Finally
adoReader.Close()
adoReader = Nothing
adoTables = Nothing
End Try
End Sub
-
May 6th, 2003, 12:00 PM
#12
So you are making a seperate trip to the db for each combo?
If thats the case then you can weed out the Nulls in the query:
VB Code:
Dim adoTables As New OleDb.OleDbCommand("Select " & ColumnStr & " From " & TableStr & " WHERE Not " & ColumnStr & " Is Null", MyConnection)
This will also reduce traffic since you only need the one column there is no need to return all of them. Hence the Select specifies the column name instead of * for all of them.
-
May 6th, 2003, 12:08 PM
#13
Thread Starter
Sleep mode
I was sure you will beat it , that's exactly what I need .
It Worked like a charm ! Thank you Edneeis
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|