Hi friends
This is Sweatha. My problem is, I have created the Registration Form with
one LabelBox as Label1
one TextBox as TextBox1 &
one Button as Button1. Then I have generated the random numbers by writing the WebMethod in Web Service as
<WebMethod()> Public Function random1() As Double
Dim Rand As New Random
Dim i As Double
i = Rand.NextDouble
End Function
and calling the WebMethod in Page Load event as
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim obj As New RandomService
Dim value As Double
Dim Random1 As New Random
Label1.Text = Random1.Next
End Sub
In the back end(SQL Server) I have created the table named matching with one field named 'match'.
Now the trouble is
I have to check whether the value entered in the TextBox is equal to that of the one which is in the LabelBox (which is the random one which is automatically generated) and if the value is same then the particular value should be inserted into the (backend) match field in the matching table by using insert query as
If TextBox1.Text = Label1.Text Then
str1 = "Insert into matching values(" & TextBox1.Text & ")"
cmd = New SqlCommand(str1, con)
cmd.ExecuteNonQuery()
con.Close()
Response.Write("Inserted")
End If
My foremost problem is once if I click the button, the page is getting refreshed and the random number in label is changing and the TextBox Values are not getting equal to the LabelBox values & so I cant insert it into the DataBase.