Error while saving a value - InfoPath Dev
in

InfoPath Dev

Error while saving a value

Last post 04-15-2010 11:06 PM by alexia_net. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 04-15-2010 06:17 AM

    Error while saving a value

    Hi. I am having the fillowing code

                        m_cmdSqlCommand = New SqlCommand("INSERT INTO Comments(userId) VALUES('" + m_userId + "')", m_conSqlConnection)
                        m_drDataReader = m_cmdSqlCommand.ExecuteReader
                        m_drDataReader.Close()

    The strange thing is that I get an error saying

    "Convertion from string "INSERT INTO Comments(userId)..." to type double is not vallid.

    Now, userId is a key comming from the User table, and it is Int not Double. The Cascade option is not enabled. The value which I am trying to save is int, from variable

    m_userId = m_dtBuilding.Rows(m_rowPosition)("userId")

    Does anyone know why I get this error? Thank you!

     

  • 04-15-2010 06:31 AM In reply to

    Re: Error while saving a value

    try converting m_userId to double

    Convert.ToDouble (m_userId)

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-15-2010 06:39 AM In reply to

    Re: Error while saving a value

     Hi. Thank you for your reply. I have even changed the database fields to decimal (from both tables where the primary key resides and in the one where it migrates). I am using sql server 2008 express as database; i have no double there to choose. The same problem. If it is text it works but i cannot use autoincrement on the primary key, and this is something i do not have to loose. I need that autoincrement proprety for the table where userId is primary key. Thank you!

  • 04-15-2010 11:06 PM In reply to

    Re: Error while saving a value

     Hi. The solution is simple but very strange. I have to convert the integer into string and then i can save it into the database, in a field which is integer. LOL! Thank you for your help anyway.

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.