Visual Studio 2008 mobile sql server insert

Public Class Uretim_Giris
Dim SqlConnStr As String = “server=192.168.0.144;database=ALIM;uid=HALI;pwd=01234;”
Dim SqlConn As New System.Data.SqlClient.SqlConnection(SqlConnStr)
Dim Readerim As System.Data.SqlClient.SqlDataReader
Dim SqlComm As New System.Data.SqlClient.SqlCommand(“”, SqlConn)

Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
Me.Close()

End Sub

Private Sub editpersonel_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles editpersonel.KeyPress
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Enter) Then
editbarcode.Focus()
End If
End Sub

Private Sub editbarcode_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles editbarcode.KeyPress
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Enter) Then
editmiktar.Focus()
‘editmiktar.SelectedText(“3″)
End If
End Sub

Private Sub Uretim_Giris_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
editpersonel.Focus()
End Sub

Private Sub editmiktar_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
Dim hatasayisi As Integer
Dim girilensayi As Double
hatasayisi = 0

If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Enter) Then
girilensayi = editmiktar.Text
ElseIf (editbarcode.Text = “”) Then
editbarcode.Focus()
editbarcode.Text = “bos”
hatasayisi = hatasayisi + 1
ElseIf (editpersonel.Text = “”) Then
editpersonel.Focus()
editpersonel.Text = “bos”
hatasayisi = hatasayisi + 1
ElseIf girilensayi < 0 Then
‘editmiktar.Focus()
hatasayisi = hatasayisi + 1
End If

If hatasayisi = 0 Then
MenuItem1.Enabled = False
MenuItem2_Click(sender, e)

End If
End Sub

Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click

Dim hatasayisi As Integer
Dim girilensayi As Double

hatasayisi = 0
girilensayi = editmiktar.Text
MenuItem2.Enabled = False

If (editbarcode.Text = “”) Then
editbarcode.Focus()
editbarcode.Text = “bos”
hatasayisi = hatasayisi + 1
ElseIf (editpersonel.Text = “”) Then
editpersonel.Focus()
editpersonel.Text = “bos”
hatasayisi = hatasayisi + 1
ElseIf girilensayi < 0 Then
editmiktar.Focus()
hatasayisi = hatasayisi + 1
End If

If hatasayisi = 0 Then
MenuItem1.Enabled = False
End If
If hatasayisi = 0 Then
SqlConn.Open()
‘Me.Tag = Me.Tag + 1
‘ Me.Text = “kaydetke” & Me.Tag ‘bu kodu sonraq kaldır
Me.BackColor = Color.DarkRed

SqlComm.CommandText = “INSERT INTO T_PERSONEL_URETIM (PERSONEL,MATERIAL,MIKTAR) VALUES (‘” & editpersonel.Text & “‘,’” & editbarcode.Text & “‘,’” & girilensayi & “‘)”
SqlComm.ExecuteNonQuery()
editpersonel.Text = “”
editbarcode.Text = “”
editmiktar.Text = “0,0″
MenuItem1.Enabled = True
editpersonel.Focus()

SqlConn.Close()

Me.BackColor = Color.DarkBlue
End If

MenuItem2.Enabled = True
End Sub
End Class

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir