ASP.net代码翻译
DimmyconnAsData.OleDb.OleDbConnection=NewData.OleDb.OleDbConnection("Provider=Microso...
Dim myconn As Data.OleDb.OleDbConnection = New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/App_Data/") + "data.mdb;Persist Security Info=False")
Dim mysql As String
Dim mycmd As Data.OleDb.OleDbCommand
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
myconn.Open()
mysql = "update 1 set piaoshu= piaoshu + 1 where name='" + RadioButtonList1.SelectedItem.Text + "'"
mycmd = New Data.OleDb.OleDbCommand(mysql, myconn)
mycmd.ExecuteNonQuery()
myconn.Close()
ClientScript.RegisterClientScriptBlock(System.Type.GetType("System.String"), "_error", "<script>window.open('html/tp.aspx')</sc" + "ript>")
Response.Redirect("2.aspx")
End Sub 展开
Dim mysql As String
Dim mycmd As Data.OleDb.OleDbCommand
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
myconn.Open()
mysql = "update 1 set piaoshu= piaoshu + 1 where name='" + RadioButtonList1.SelectedItem.Text + "'"
mycmd = New Data.OleDb.OleDbCommand(mysql, myconn)
mycmd.ExecuteNonQuery()
myconn.Close()
ClientScript.RegisterClientScriptBlock(System.Type.GetType("System.String"), "_error", "<script>window.open('html/tp.aspx')</sc" + "ript>")
Response.Redirect("2.aspx")
End Sub 展开
1个回答
展开全部
//新建数据库连接对象,参数是数据库的路径
Dim myconn As Data.OleDb.OleDbConnection = New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/App_Data/") + "data.mdb;Persist Security Info=False")
Dim mysql As String //声明字符串类型的变量mysql
Dim mycmd As Data.OleDb.OleDbCommand //声明command对象
//按钮Button1的点击时调用的函数
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
myconn.Open() //打开数据库连接
mysql = "update 1 set piaoshu= piaoshu + 1 where name='" + RadioButtonList1.SelectedItem.Text + "'" //sql语句
mycmd = New Data.OleDb.OleDbCommand(mysql, myconn) //新建命令对象
mycmd.ExecuteNonQuery() //执行sql查询
myconn.Close() //关闭数据库连接
//向前台页面注册一段JS代码
ClientScript.RegisterClientScriptBlock(System.Type.GetType("System.String"), "_error", "<script>window.open('html/tp.aspx')</sc" + "ript>")
//重定向到2.aspx页面
Response.Redirect("2.aspx")
End Sub
Dim myconn As Data.OleDb.OleDbConnection = New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/App_Data/") + "data.mdb;Persist Security Info=False")
Dim mysql As String //声明字符串类型的变量mysql
Dim mycmd As Data.OleDb.OleDbCommand //声明command对象
//按钮Button1的点击时调用的函数
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
myconn.Open() //打开数据库连接
mysql = "update 1 set piaoshu= piaoshu + 1 where name='" + RadioButtonList1.SelectedItem.Text + "'" //sql语句
mycmd = New Data.OleDb.OleDbCommand(mysql, myconn) //新建命令对象
mycmd.ExecuteNonQuery() //执行sql查询
myconn.Close() //关闭数据库连接
//向前台页面注册一段JS代码
ClientScript.RegisterClientScriptBlock(System.Type.GetType("System.String"), "_error", "<script>window.open('html/tp.aspx')</sc" + "ript>")
//重定向到2.aspx页面
Response.Redirect("2.aspx")
End Sub
更多追问追答
追问
0.0好厉害啊 帮忙把这段也翻译一下吧 我加分!
追答
把代码贴出来吧,图片加注释太费力了。。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询