在sql数据库中同时重复记录 [英] Duplicate Record in the same time in sql database

查看:77
本文介绍了在sql数据库中同时重复记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个代码我创建它在sql数据库中插入Valus但是这个代码同时插入重复记录



我不知道为什么这个重复







This code i create it to insert Valus in sql Database but this Code insert Duplicate Record in the same time

I do not know why this Duplication



connectionString = ConfigurationManager.ConnectionStrings("conString").ToString
con = New SqlConnection(connectionString)
con.Open()
cmd = New SqlCommand("INSERT INTO Msg (ID,MsgName,MgsPhone,MsgAdd,Msgmail,Msgcomm,msgdate,Msgtime,latitude,longitude)VALUES ( '" + Request.QueryString("ID") + "', '" & TxtName.Text & "', '" & TxtPhone.Text & "', '" & TxtAdd.Text & "', '" & TxtMail.Text & "' , '" & Txtcomm.Text & "' , '" & System.DateTime.Now.ToString((" yyyy-MM-dd")) & "','" & System.DateTime.Now.ToShortTimeString() & "', '" & latitude & "', '" & longitude & "')", con)
cmd.ExecuteNonQuery()
con.Close()
Response.Redirect(Request.Url.AbsolutePath + "?status=1", False)

推荐答案

i found the problem in this html line

         <asp:Button ID="btnSave" runat="server" CssClass="bigButton2" style="color: #FFFFFF; font-weight: 700; background-color: #333333" Text="Send" Width="180px" Height="38px" onclick="btnSave_Click" />


in this code  (onclick="btnSave_Click" />)


这篇关于在sql数据库中同时重复记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆