Results 1 to 6 of 6

Thread: No record save after adding new recod

  1. #1

    Thread Starter
    Member kryptonboy22's Avatar
    Join Date
    May 2006
    Location
    philippines
    Posts
    48

    No record save after adding new recod

    Can anyone tell me why i cant add record. there's no error in my codes but im not sure if its right. im a newbie and just doing self study on mobile development.

    here's my code:

    Code:
      
       Try
                Me.T_InventoryBindingSource.AddNew()
                Me.T_InventoryTableAdapter.Insert(iBarcode, iItemdesc, iRSP,      
                                       Val(iCount), CDbl("0"), "a", "a1", iItemcode)
                Me.T_InventoryTableAdapter.Update 
                                        (Me.SQL2005MobileDataSet.t_Inventory)
    
              
         Catch ex As System.Exception
                 System.Windows.Forms.MessageBox.Show(ex.Message)
         End Try

    thanks guys

  2. #2

    Thread Starter
    Member kryptonboy22's Avatar
    Join Date
    May 2006
    Location
    philippines
    Posts
    48

    Re: No record save after adding new recod

    Please anyone there i really need help on mobile! i dont know how insert works using table adapter

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: No record save after adding new recod

    I looked at this, but I haven't used table adapters. There are so many ways to get data into databases that there are whole areas that I have never ventured into.

    However, this isn't necessarily an issue for mobile dev, despite the fact that you are working on a mobile device. Therefore, you might get many more eyes, and more knowledgeable eyes, by moving this question over to the .NET section.
    My usual boring signature: Nothing

  4. #4

    Thread Starter
    Member kryptonboy22's Avatar
    Join Date
    May 2006
    Location
    philippines
    Posts
    48

    Re: No record save after adding new recod

    thanks shaggy! im also looking to that option now, I just thought that its the only option i can use. Im a newbie and mobile dev really amazed me. thanks again for the advice!

  5. #5

    Thread Starter
    Member kryptonboy22's Avatar
    Join Date
    May 2006
    Location
    philippines
    Posts
    48

    Re: No record save after adding new recod

    by the way can you give me some hint or any reference how to make an easy record adding? dont have an idea on this! thanks!

  6. #6

    Thread Starter
    Member kryptonboy22's Avatar
    Join Date
    May 2006
    Location
    philippines
    Posts
    48

    Re: No record save after adding new recod

    Please take a look on my new code... same problem again. No error occurred and value passed but still no record was saved. what's the problem? I really dont get it. Is there any settings or any thing i have to configure on my dbase SQL Server Mobile

    Code:
        Private Sub ConnDatabase()
           Try
                ' connection to be open to perform various functions
                conn = New SqlCeConnection("Data Source =" _
                            + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.GetName.CodeBase) _
                            + ("\SQL2005Mobile.sdf;" _
                            + ("Password =" + """admin"";"))))
                conn.Open()
    
                ' Create ResultSet
                cmd = conn.CreateCommand
                cmd.CommandText = "SELECT  EANUPC, Itemdesc,Itemcode, RSP, Count  FROM t_Inventory"
    
                rs = cmd.ExecuteResultSet(ResultSetOptions.Updatable Or ResultSetOptions.Scrollable)
    
            Catch ex As Exception
                MessageBox.Show("Error: " & ex.Message)
            End Try
        End Sub
    
    
    Private Sub AddRecord(ByVal rs As SqlCeResultSet, ByVal iBarcode As String,  ByVal iItemDesc As String, ByVal iItemCode As String, ByVal iRSP As String, ByVal iCount As String)
    
    
            Dim rec As SqlCeUpdatableRecord = rs.CreateRecord()
            iBarcode = Me.LblBarcode.Text
            iItemDesc = Me.LblItemdesc.Text
            iItemCode = Me.LblItemcode.Text
            iRSP = Me.RSPTextBox.Text
            iCount = Me.CountTextBox.Text
    
            rec.SetString(0, iBarcode)
            rec.SetString(1, iItemDesc)
            rec.SetString(2, iItemCode)
            rec.SetDecimal(3, iRSP)
            rec.SetDouble(4, iCount)
    
            rs.Insert(rec)
    
                 conn.Close()
                 conn.Dispose()
                 conn = Nothing
        End Sub


    I really need help on this...Please! please! Thanks! vbforum d' best

Posting Permissions

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



Click Here to Expand Forum to Full Width