473,325 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Verify the Insertion of records

ak1dnar
1,584 Expert 1GB
Hi There,
After Inserting records successfully, I need to Redirect to the Next Page.
Currently I have decalred a Boolean variable and initial value for that has set to false.
Then in side the try block i am going to change the value for that variable as true.

After checking this value in a IF block, I can redirect to the next page.

Is this way is good or can you suggest a new way to do that.
Is there any way to get the affected rows and based on that how can i redirect it.

Thanks

Expand|Select|Wrap|Line Numbers
  1. 'Connection String and Other rest of the Coding Goes here
  2. Private Sub btn_submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_submit.Click
  3.  
  4.         Dim goToStep As Boolean = False
  5.         Dim StrtxtQua As String = txtQua.Text
  6.         Dim StrtxtGMC As String = txtGMC.Text
  7.         Dim StrtxtSpcInterest As String = txtSpcInterest.Text
  8.         Dim StrtxtNHS_post As String = txtNHS_post.Text
  9.         ' Dim StrtxtYearQua As Integer = txtYearQua.Text
  10.  
  11.  
  12.         conn = New SqlConnection(conStr)
  13.  
  14.         Dim UpdateStr As String = "update consultants SET Qualifications = @Qualifications where Dr_no = '" & ChkAuthID & "'"
  15.         Dim cmd_Update As SqlCommand = New SqlCommand(UpdateStr, conn)
  16.  
  17.         cmd_Update.Parameters.Add(New SqlParameter("@Qualifications", StrtxtQua))
  18.  
  19.         Try
  20.             cmd_Update.Connection.Open()
  21.             cmd_Update.ExecuteNonQuery()
  22.             cmd_Update.Connection.Close()
  23.             goToStep = True ' This is a boolean Variable. Declared ealier
  24.         Catch sqlEx As SqlException
  25.  
  26.             Response.Write("Error: SQL Exception Occured<br>")
  27.  
  28.         Catch ex As Exception
  29.             Response.Write("Error: Unknown System Error Occured<br>")
  30.         End Try
  31.         If goToStep = True Then
  32.             Response.Redirect("step_2.aspx")
  33.         End If
  34.     End Sub
  35.  
Jun 28 '07 #1
0 839

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

Similar topics

3
by: narasimha | last post by:
Hello, I have a data record with two fields...<value, date>. I have more than a million of these records. As I add more records into this set, I want a data structure that would be efficient...
20
by: Patrick Guio | last post by:
Dear all, I have some problem with insertion operator together with namespace. I have a header file foo.h containing declaration of classes, typedefs and insertion operators for the typedefs in...
10
by: Anton.Nikiforov | last post by:
Dear all, i have a problem with insertion data and running post insert trigger on it. Preambula: there is a table named raw: ipsrc | cidr ipdst | cidr bytes | bigint time | timestamp...
3
by: Sunny | last post by:
Hi All, I am working on a Data Project, that involves records (rows) to be inserted from a Table in one database to an exactly similar table in another database. The table names and all field names...
0
by: polocar | last post by:
Hi, I have noticed a strange behaviour of CurrencyManager objects in C# (I use Visual Studio 2005 Professional Edition). Suppose that you have a SQL Server database with 2 tables called "Cities"...
1
by: =?Utf-8?B?TWljaGFlbCBCbHVtZW50aGFsLCBNQ1NFLCBNQ0FE | last post by:
I am writing a .NET 1.1 C# windows service that writes to a dedicated event log (not the application event log, but one that I created). I want to make full use of all the fields in an event log...
3
by: deepthithallada | last post by:
Hi, While inserting records in the table, is there any way we can change the order in which we insert the records. Eg: Say i have 3 columns in a table, while inserting the records can i make...
1
by: donut | last post by:
Hi, i am currently preparing a Data Migration Plan for migration of existing data from ADABAS to DB2. The data volume can be as huge as 200 GB. Since it is impossible to verify all the data migrated,...
3
by: dilippanda | last post by:
Hi All, I am experiencing performance issue while merging records from a select query. Also it is getting difficult to insert 100000 selected records into table which is taking around 30 mins. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.