Here is my code.(submit botton) whenever I refresh,the previous data posts back to the database.how do I prevent this please.Also,how do I prevent posting existing to database. - Partial Class Contact
-
Inherits System.Web.UI.PageProtected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
-
Dim maluda As New SqlDataSource
-
With maluda
-
.ConnectionString = ConfigurationManager.ConnectionStrings("unique2").ConnectionString
-
.InsertCommandType = SqlDataSourceCommandType.Text
-
.InsertCommand = "insert into dbcontact(Fname,Email,Phone,Gender,State,Subject,Msg,Cdate) values (@Fname,@Email,@Phone,@Gender,@State,@Subject,@Msg,@Cdate)"
-
.InsertParameters.Add("Fname", txtfname.Text)
-
.InsertParameters.Add("Email", txtemail.Text)
-
.InsertParameters.Add("Phone", txtPN.Text)
-
.InsertParameters.Add("Gender", txtgender.SelectedItem.ToString)
-
.InsertParameters.Add("State", txtstate.SelectedItem.ToString)
-
.InsertParameters.Add("Subject", txtsubject.Text)
-
.InsertParameters.Add("Msg", txtmsg.Text)
-
.InsertParameters.Add("Cdate", Date.Today)
-
-
End With
-
Dim luda As String
-
luda = maluda.Insert()
-
-
'lblsucess.Text = "Delivered"
-
UserMsgBox(sMsg:="Msg sent...click ok to continue")
-
-
txtfname.Text = ""
-
txtemail.Text = ""
-
txtPN.Text = ""
-
txtsubject.Text = ""
-
txtmsg.Text = ""
-
End Sub
-
-
-
-
-
-
-
Public Sub UserMsgBox(ByVal sMsg As String)
-
-
Dim sb As New StringBuilder()
-
Dim oFormObject As System.Web.UI.Control
-
-
sMsg = sMsg.Replace("'", "\'")
-
sMsg = sMsg.Replace(Chr(34), "\" & Chr(34))
-
sMsg = sMsg.Replace(vbCrLf, "\n")
-
sMsg = "<script language=javascript>alert(""" & sMsg & """)</script>"
-
-
sb = New StringBuilder()
-
sb.Append(sMsg)
-
-
For Each oFormObject In Me.Controls
-
If TypeOf oFormObject Is HtmlForm Then
-
Exit For
-
End If
-
Next
-
-
-
oFormObject.Controls.AddAt(oFormObject.Controls.Count, New LiteralControl(sb.ToString()))
-
-
End Sub
0 1581 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Pete..... |
last post by:
Hi all.
I have made a webpage where there is a webform where people can fill in
their personel information:
The code is below:
I want to transfer the data to a postgreSQL database ( I have...
|
by: cooldv |
last post by:
i know how to replace the sign " when SUBMITTING a form in asp by this
code:
message = Replace(usermessage, "'", "''").
My problem is DISPLAYING data in an asp FORM, from an an access
database,...
|
by: KC |
last post by:
Hello,
I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB.
I have tweaked this DB to work for our small co.
It has worked pretty well up until I made the mistake of deleting...
|
by: Jim Heimer |
last post by:
How can I pass data from one child form to another? I have two forms, one
(formX) that holds a datagrid (with the results of a query) and another
(formY) that consists of many textboxes. I'd like...
|
by: steve |
last post by:
Hi All
I need to learn how to update a SQl server or Access database located on a
web server from my windows forms application, via the internet
I have a customer who wants to run several...
|
by: punitshrivastava |
last post by:
Hi all,
I am Punit
I am working in php .i want to delete records from database from php form .
For this i code the code is:
<?php
$name = $_POST;
$host="localhost"; // Host name ...
|
by: chamali |
last post by:
Hi guys,
I have created database using ms access & i have ceated a form using vb.net.
i want to do this. when i enter the data to the form & after that click Submit button the data must be enter...
|
by: Mapi |
last post by:
I need help.
I am new to MS Access and have been assign this project.
I want to be able to filter data from a form that will be displayed on a subform.
I don't know if this is possible but...
|
by: John York |
last post by:
I setup an online Access database and created a online data submission form using FrontPage 2003 to send data to the Access database. Works great for Windows users and some Mac computer users....
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |