I am building a web application that allows a user to submit and retrieve data that they have submitted.
I am able to do the coding to submit and search for these forms based on reference numbers but i can't seem to display the reference numbers once a form is submitted.
The reference number is created on the database as soon as a record hits the table. I would like to make it so that when the user presses the "submit" button, a message indicating their reference number will pop up i.e. ("Reference Number ___ has been assigned to your record").
Here's the code to submit one of the forms - i would like to make it so that i can retreive the reference number INTO the blank space above:
Partial Class _Default
Dim validated As Boolean
'CI Submit and clear
Protected Sub btnSubmit2_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit2.Click
' Submit CI
'Open connection string and insert data into the database, Data table
Dim ConnectionString As String
Dim Connection As SqlConnection
Dim Adapter As New SqlDataAdapter
Dim sql As String
Dim ds As New DataSet
ConnectionString = "Data Source=00.0.000.00;Initial Catalog=QOI;User ID=user;pwd=pwd;"
Connection = New SqlConnection(ConnectionString)
sql = "insert into Reports_Entry(Customer_ID, Account_Number, Report_Description_1, PBR_ID, Report_Acronym, Date_Occurred, Review_Flag) VALUES ('" & tbCustomerid2.Text & "','" & tbaccountnumber2.Text & "', '" & DropDownList3.SelectedValue & "','" & tbPBRID.Text & "', '" & lblacronym.Text & "', Convert(datetime,'" & Trim(tbDate2.Text) & "',103), '" & "No" & "' );"
Adapter.InsertCommand = New SqlCommand(sql, Connection)
Response.Write("<span style='color: green'>Reference Number ____ has been assigned to your record</span>")
Catch ex As Exception
Response.Write("<span style='color: red'>Reference Number ____ has NOT been assigned to your record</span>")
tbCustomerid2.Text = ""
tbaccountnumber2.Text = ""
DropDownList3.SelectedIndex = -1
lblacronym.Text = ""
lblreportheading.Text = ""
ddlreportname.SelectedIndex = -1
tbPBRID.Text = ""
lblagentname.Text = ""
lblpavilion.Text = ""
lblmanager.Text = ""
lblarea.Text = ""
lblregion.Text = ""
lblbusiness.Text = ""
lblerror2.Text = ""
Employeestatspanel.Visible = False
EmployeePanel.Visible = False
CIPanel.Visible = False
RefNumPanel.Visible = False
Thanks a lot for your time!