For whatever reason beyond my understanding did my DB start this problem.

I got 2 tables in my database.
1 dealing with personal info
1 with dates and time

To keep my startup form empty I have the first row empty in both tables.
But for some reason after I did a truncate in my date/time table it's not keeping the empty row up top.

So now each time I start up I got data already entered
Because the empty row is not first in order.

Is there something which has changed a property when I truncate that table?

Recommended Answers

All 9 Replies

Truncate table does just that - there are no empty rows after running that command.
What you are probably seeing is whatever SQL has for the default value on that column.

This is more of a SQL question, rather than VB specific

Yeah sorry your right, it kinda is a SQL question.

I know truncate clears the table.
But I added a new empty row first, so I always have that.

Are there other options to avoid reading the first row of your table perhaps?

I know truncate clears the table.
But I added a new empty row first, so I always have that.

Adding an empty row is not really a viable solution. There are a lot of strong words (none of them very nice, some much ruder than others) that come to mind if you were doing that to my production database! :)

Are there other options to avoid reading the first row of your table perhaps?

There is no first row after the Truncate Table statement.

How are you displaying your data? You could probably do something with the SelectedIndex, Text or whatever property.

Yeah i know its not really a clean method to do it.

Right now my DB table content is just loaded on the start.
So whatever i got in my first row will be showing.

What controls are you using to display the data?

It's all in textboxex.

I've never used TextBoxEx, but you should be able to set the TextBox.Text property in your code, correct? I believe that you should be able to set that text property to vbNullString or "" without triggering an insert to your database (test this thoroughly!!!) - and setting that property after you aquire the data should override the display text in the textbox.

Sorry late reply, had some net issues.

I am going to look into vbNullString, should be a lot cleaner that way.
Thanks for the help.

No problem, don't forget to mark thread as solved if/when you're done

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.