By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 924 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

When textbox is null it will not insert data

P: 14
Hello there, I have 2 tables in my database, all i want to do is when the time txtJobstart is null then it will not insert the data to the tbl2 but all the data from other fields will save to tbl1.

Expand|Select|Wrap|Line Numbers
  1. If txtJobStart.Text = "" Then
  2.             'Don't save, do nothing
  3.         Else
  4.             Dim constr As String = ConStrX
  5.             Using test As New SqlConnection(constr)
  6.                 Using probe As New SqlCommand("JobStartMonitoring")
  7.                     Using sda As New SqlDataAdapter()
  8.                         probe.CommandType = CommandType.StoredProcedure
  9.                         probe.Parameters.AddWithValue("@JobStart", txtJobStart.Text)
  10.                         probe.Parameters.AddWithValue("@TotalNoOfPins", txtTotalPins.Text)
  11.                         probe.Parameters.AddWithValue("@TotalNoOfJobs", txtTotalJO.Text)
  12.                         probe.Connection = test
  13.                         test.Open()
  14.                         probe.ExecuteNonQuery()
  15.                         test.Close()
  16.                     End Using
  17.                 End Using
  18.             End Using
  19.         End If
Jul 11 '15 #1
Share this Question
Share on Google+
1 Reply

P: 320
I'm sorry... is there a question here I'm missing?
Jul 11 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.