Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hello,
I am trying to insert a value in a detail table in the FK from a text box. here is the code, I get no error but I have no record also.


VB
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
          Me.SqlDataAdapter3.InsertCommand.Parameters(0).Value = Convert.ToInt32(TextBox22.Text)
        Me.BindingContext(DataSet31, "scan").EndCurrentEdit()
        Me.BindingContext(DataSet31, "scan").AddNew()
       AxVintaSoftTwain2.StartDevice()
        AxVintaSoftTwain2.SelectSource()
        AxVintaSoftTwain2.ShowUI = False
        AxVintaSoftTwain2.DisableAfterAcquire = True
        AxVintaSoftTwain2.OpenDataSource()
        AxVintaSoftTwain2.UnitOfMeasure = 0          ' inches'
        AxVintaSoftTwain2.PixelType = 2              ' RGB image'
        AxVintaSoftTwain2.Resolution = 200           ' 200 dpi'
        AxVintaSoftTwain2.Brightness = AxVintaSoftTwain2.BrightnessMaxValue
        AxVintaSoftTwain2.Contrast = 0
        AxVintaSoftTwain2.SetImageLayout(1, 1, 5, 5) 'image size in inches'
        AxVintaSoftTwain2.Acquire()
    End Sub

    Private Sub VSTwain1_PostScan(ByVal sender As System.Object, ByVal e As AxVSTWAINLib._IVintaSoftTwainEvents_PostScanEvent) Handles AxVintaSoftTwain2.PostScan
        If e.flag <> 0 Then
            If AxVintaSoftTwain2.ErrorCode <> 0 Then
                MsgBox(AxVintaSoftTwain2.ErrorString)
            End If
        Else
            If Not (PictureBox1.Image Is Nothing) Then
                PictureBox1.Image.Dispose()
                PictureBox1.Image = Nothing
            End If
            PictureBox1.Image = AxVintaSoftTwain2.GetCurrentImage
        End If
End Sub

 Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        Me.BindingContext.Item(DataSet31,"scan").EndCurrentEdit()
        Me.SqlDataAdapter3.Update(DataSet31)
        Me.DataSet31.AcceptChanges()
        Me.SqlConnection1.Close()
        Me.SqlConnection1.Open()
        Me.DataSet31.Tables("scan").Clear()
        Me.SqlDataAdapter3.Fill(DataSet31, "scan")
    End Sub
Posted
Updated 7-Apr-11 0:28am
v2
Comments
thatraja 7-Apr-11 6:05am    
what's the error message? include that in your question.
Sandeep Mewara 7-Apr-11 8:19am    
OP says no error but no record. (Though I fail to understand his question totally and don't want to put much of my mind here, so I will pass.)
Sunasara Imdadhusen 7-Apr-11 6:28am    
Added code formatting!!
Member 4312989 7-Apr-11 8:48am    
Are you trying to store the image in the table?
Or its just a insert query with text and number values?
Wendelius 7-Apr-11 15:03pm    
Could you include the statements used by the data adapter into the post. The ones that are defined by SqlCommand objects in UpdateCOmmand and InsertCommand properties.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900