in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

AutoIncrement while working with dataadapter

Last post 05-01-2008 12:24 PM by alon1980. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 04-16-2008 2:42 PM

    AutoIncrement while working with dataadapter

    Hello,

    I am a newbie and just started to develop an application that mimics roboform.

    I designed a table with an auto increment column (column name is "WebSiteIndex") and when i try to add a new row from the code like this :

        MainDataSet.WebLoginDataRow loginRow = m_DataSet.WebLoginData.NewWebLoginDataRow();

        loginRow.UserName = "alon";
        loginRow.Address = "333";
        loginRow.PasswordFieldName = "444";
        loginRow.PasswordFieldValue = "sss";

        m_DataSet.WebLoginData.AddWebLoginDataRow(loginRow);
        m_WebLoginTableAdapter.Update(m_DataSet.WebLoginData);

    I get an exception. I even tried putting "loginRow.WebSiteIndex = null" but that also can't be done since the column is auto incremented and therefore 

    defined as "nut null".

    How can I insert a new row and make the auto incremented column advance correctly?

    Thanks! 

  • 04-16-2008 3:43 PM In reply to

    Re: AutoIncrement while working with dataadapter

    What's the table schema?

  • 04-16-2008 10:08 PM In reply to

    Re: AutoIncrement while working with dataadapter

     here is the schema:

    CREATE TABLE [WebLoginData] (
    [UserName] nvARCHAR(20)  NOT NULL,
    [Address] nvARCHAR(300)  NOT NULL,
    [PasswordFieldName] nvARCHAR(20)  NOT NULL,
    [PasswordFieldValue] nvARCHAR(20)  NOT NULL,
    [UserFieldName] nvARCHAR(20)  NOT NULL,
    [UserFieldValue] nvARCHAR(20)  NOT NULL,
    [ThirdFieldName] nvARCHAR(20)  NULL,
    [ThirdFieldValue] nvARCHAR(20)  NULL,
    [WebSiteIndex] INTEGER  NOT NULL PRIMARY KEY
    );

    this schema was created using  "sqlite administrator" program.

     

  • 04-18-2008 1:45 AM In reply to

    Re: AutoIncrement while working with dataadapter

     Hey,

    Please don't give up on me...

    thanks! 

  • 04-18-2008 2:48 PM In reply to

    Re: AutoIncrement while working with dataadapter

    Can you give me a complete error stack dump?

  • 05-01-2008 12:24 PM In reply to

    Re: AutoIncrement while working with dataadapter

     I don't understand how, but it works now.

    I just rebuided the project and it seems to be ok now.

    I have another problem - I have a table with 20 columns. I added another column using SQLITE administrator and for some reason

    the Database explorer in the designer mode, reads the new columnas read only and i can't enter any data.

    moreover, when i run my program (after i used  SQLITE administrator to enter some data) upon reading from that column i am getting DBNULL exception.

    any ideas?

    thanks! 

Page 1 of 1 (6 items)
Powered by Community Server (Commercial Edition), by Telligent Systems