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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strange problem inserting values into database

Status
Not open for further replies.

kenndot

Programmer
May 15, 2001
316
0
0
US
Here's the problem

I go through a loop to insert values into the database. I get no errors and I've done watches to make sure there really is a value being inserted. I'm watching the variable that is holding the value to be inserted and watching the value that holds the database information and everything appears to be working while going through my code in debug mode, however when I look in the database, some (5 out of 40 fields) do not show up. I know the fields are not blank because of the watches, AND because if the field is blank I insert a "n/a" string into the database field, which does work on several fields, just not these particular 5.

These certain fields are simply blank, no "n/a" and no value at all. Does anyone have any ideas of what to check?

The types are String in VB and I'm inserting that string into a text field in the database and yes I'm sure that those types are correct as I'm using an array of strings for the entire volume of values. I've deleted the fields in the db and re-entered in case something was corrupt, no change there.

As I said, I am getting no errors at all, I just simply don't see any values in the database.

I think that's it, let me know if I can give more information and thanks if anyone can think of anything more for me to check!
 
of course! here it is...

Do Until Idx = 72

rs.Fields(Idx) = Left(NTFields(Idx), 254)

If rs.Fields(Idx).Value = "" Then
rs.Fields(Idx).Value = "n/a"
End If

Idx = Idx + 1

Loop
rs.Update

I think this is what you need to see, all the connection "stuff" is working fine so I didn't bother including that...
 
You don't say what kind of DB it is, or how you are "Viewing" the data. If it is a SQL Server DB & you are using the SQL Server Manager (can't think of the exact name of it), the mngr program won't show data for "Text" fields. Try getting a rs and see if you get values back. Tim

Remember the KISS principle:
Keep It Simple, Stupid! :cool:
 
Hi TimLarkin,

You're right, I forgot to say that it's an Access DB and I did mention though that I'm creating watches in VB to see what the fields values are after I do the insert and update.

And no they are not Null and it must be something other than a space because the trim function is not working.

Any ideas?
 
SCVB,

Thanks for the response. I got it figured out though. It was dragging the carriage return and line feed character from the previous line and sticking those in front of the values I wanted, so when I just got rid of that char I was all set. Thanks again everyone!
 
I've done that. So confusing until you think to increase the row height and bingo, there they are. Peter Meachem
peter@accuflight.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top