|  |  | 
          
            | โค้ดSave Table เดียวของผมประมาณนี้คับ แต่ผมต้องการ SaveลงในTable อีก2Table คือต้องการSaveข้อมูลลง Table Material = Mat_ID,TypeMat_ID ต้องเขียนโค้ดเพิ่มประมาณไหนคับรบกวนทีคับ Code (VB.NET)
 
  Private Sub ButtonSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSave.Click
        If IsDataComplete() = False Then
            Exit Sub
        End If
        sql = "INSERT INTO Jewelry "
        If Not (PictureBox1.Image Is Nothing) Then
            sql &= "(Jew_ID,TypeJew_ID,Picture)" &
            "VALUES(@jew,@Type,@pic)"
        Else
            sql &= "(Jew_ID,TypeJew_ID)" &
            "VALUES(@jew,@Type)"
        End If
        command.Parameters.Clear()
        command.CommandText = sql
        command.Parameters.AddWithValue("@jew", txtjewid.Text)
        command.Parameters.AddWithValue("@Type", txttypeid.Text)
   
        If Not (PictureBox1.Image Is Nothing) Then
            Dim pic() As Byte = ReadImage()
            command.Parameters.AddWithValue("pic", pic)
        End If
        Dim result As Integer = command.ExecuteNonQuery()
        If result = -1 Then
            MessageBox.Show("เกิดข้อผิดพลาดไม่สามารถเพิ่มข้อมูลได้")
        Else
            MessageBox.Show("บันทึกข้อมูลแล้ว")
            ButtonAdd.PerformClick()
        End If
    End Sub
 
 
 Tag : .NET, VB.NET
 
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2013-04-23 10:04:43 | By :
                          tumsonicsnk | View :
                          756 | Reply :
                          1 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |