[RESOLVED] Can't add integer to database-VBForums
Results 1 to 5 of 5

Thread: [RESOLVED] Can't add integer to database

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2013
    Posts
    169

    Resolved [RESOLVED] Can't add integer to database

    Hello, I'm trying to add some values to database the code below can't do that:

    VB.NET Code:
    1. insert.Parameters.Add("is86", DbType.Int32, 4, list[1]);

    I'm not getting any errors. I tried Convert.ToInt32 and int.Parse but didn't work. Can anyone hellp me?

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,107

    Re: Can't add integer to database

    What does the SQL side look like?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2013
    Posts
    169

    Re: Can't add integer to database

    It adds strings but not integers. Heres the query:

    VB.NET Code:
    1. SQLiteCommand insert = new SQLiteCommand(
    2.     "INSERT INTO tbl_programs " +
    3.     "(int_isSelected, txt_programName, int_is86, int_is64, " +
    4.     "txt_preCommand, txt_preSwitch, txt_executable, " +
    5.     "txt_switches, int_timeout, txt_md5, txt_version, " +
    6.     "txt_description, txt_category, dt_insertDate) " +
    7.     "VALUES(" +
    8.     ":isSelected, :programName, :is86, :is64, :preCommand, " +
    9.     ":preSwitch, :executable, :switches, :timeout, " +
    10.     ":md5, :version, :description, :category, :insertDate);",
    11.     m_dbConnection);

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,107

    Re: Can't add integer to database

    I take it the other fields work OK?
    Have you looked to see that list(1) is a number?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2013
    Posts
    169

    Re: Can't add integer to database

    list[1] is empty. How can I get text from combobox properly?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.