Click to See Complete Forum and Search --> : No record save after adding new recod
kryptonboy22
Mar 30th, 2008, 02:00 AM
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:
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:wave:
kryptonboy22
Apr 2nd, 2008, 12:15 AM
Please anyone there i really need help on mobile! i dont know how insert works using table adapter
Shaggy Hiker
Apr 2nd, 2008, 10:11 AM
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.
kryptonboy22
Apr 2nd, 2008, 10:17 AM
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!
kryptonboy22
Apr 2nd, 2008, 10:20 AM
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!
kryptonboy22
Apr 2nd, 2008, 11:53 AM
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
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! :wave: vbforum d' best
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.