realityfusion
New member
- Joined
- Jan 18, 2010
- Messages
- 3
- Programming Experience
- 1-3
Thank you So Much for this tutorial! http://www.vbdotnetforums.com/windo...ven-login-form-admin-backend-image-heavy.html
Finding a basic tutorial on dealing with database manipulation has been a chore. This made it very simple for me.
I am coming from a background in MS ACCESS and I am breaking into big boy programming. and things that seemed very straightforward in access seem so convoluted in VB 2008
I am having trouble getting the insertion command. Well, that's not true it works fabulously but it doesn't seem to commit the changes to the database.
I can see the changes update on the grid view when I send the values to the database. if I stop debugging and re-enter the program the values are still there. BUT if I look at the table in the sql explorer the values did not insert. and then if I start the debugger the gridview reflects those changes.
Any help would be amazing
Thank you in advance
Chase
code:
Finding a basic tutorial on dealing with database manipulation has been a chore. This made it very simple for me.
I am coming from a background in MS ACCESS and I am breaking into big boy programming. and things that seemed very straightforward in access seem so convoluted in VB 2008
I am having trouble getting the insertion command. Well, that's not true it works fabulously but it doesn't seem to commit the changes to the database.
I can see the changes update on the grid view when I send the values to the database. if I stop debugging and re-enter the program the values are still there. BUT if I look at the table in the sql explorer the values did not insert. and then if I start the debugger the gridview reflects those changes.
Any help would be amazing
Thank you in advance
Chase
code:
VB.NET:
Imports System.Data.SqlServerCe
Imports System.Data.Sql
Public Class Form1
Dim RedTextHolder
Dim BlackTextHolder
Dim NumberClickHolder
Dim my1stPosition
Dim Def As New definitions
Public Sub UserData()
Dim con As SqlCeConnection = New SqlCeConnection("Data Source=Database1.sdf")
Dim cmd As SqlCeCommand
Dim myDA As SqlCeDataAdapter
Dim myDataSet As DataSet
con.Open()
cmd = New SqlCeCommand("Select SpinNumber From Number", con)
myDA = New SqlCeDataAdapter(cmd)
myDataSet = New DataSet()
myDA.Fill(myDataSet, "Number")
DataGridView1.DataSource = myDataSet.Tables("Number").DefaultView
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
UserData()
End Sub
Private Sub Numbers_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _
Button0.Click, Button1.Click, Button2.Click, Button3.Click, Button4.Click, _
Button5.Click, Button6.Click, Button7.Click, Button8.Click, Button9.Click, _
Button10.Click, Button11.Click, Button12.Click, Button13.Click, Button14.Click, _
Button15.Click, Button16.Click, Button17.Click, Button18.Click, Button19.Click, _
Button20.Click, Button21.Click, Button22.Click, Button23.Click, Button24.Click, _
Button25.Click, Button26.Click, Button27.Click, Button28.Click, Button29.Click, _
Button30.Click, Button31.Click, Button32.Click, Button33.Click, Button34.Click, _
Button35.Click, Button36.Click
If Def.RedBlack(sender.text) = "Red" Then
RedTextHolder = RedListBox.Text
RedListBox.Text = sender.text & vbCrLf + RedTextHolder
BlackTextHolder = BlackListBox.Text
BlackListBox.Text = vbCrLf + BlackTextHolder
Else
BlackTextHolder = BlackListBox.Text
BlackListBox.Text = sender.text & vbCrLf + BlackTextHolder
RedTextHolder = RedListBox.Text
RedListBox.Text = vbCrLf + RedTextHolder
End If
Dim con As SqlCeConnection = New SqlCeConnection("Data Source=Database1.sdf")
Dim cmd As SqlCeCommand
con.Open()
cmd = New SqlCeCommand("INSERT INTO Number(SpinNumber)VALUES('" & sender.text & "')", con)
cmd.ExecuteNonQuery()
UserData()
End Sub
End Class
Last edited by a moderator: