The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Visual Studio.net (VB6) by McGowan 2005-02-14 06:25:51
Having a little trouble with the above annoying thing. I am working with an ms access db and I am trying to insert an entry into a simple database.

the links to the database all work correctly and SQL querys are working but I cant get the insert to work. Basically I have a button i click on and it is supposed to work. Heres the code.

personsDataAdapter.InsertCommand.CommandText = "INSERT INTO persons (ID, Name, Sex, Ability) " & _
"VALUES ('5', 'Ben', 'Male', 'Beginner')"
personsDataAdapter.InsertCommand.ExecuteNonQuery()

It comes back with an error saying "ExecuteNonQuery requires an open and available connection, the connection is currently closed"

But like I say everything else would suggest it is open. Any help greatly appreciated.
[ Reply ]
  Try this by NCBob274092005-02-14 07:34:11
    And put the ExecuteNonQuery inside a "try", with by bwkaz2005-02-14 14:49:51

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)