网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

vb.net数据库语法 vbnet access数据库

vb.net update语法

其他的没法看,不过下面这句是肯定有问题的,应该连编译都过不了:

目前创新互联已为上千的企业提供了网站建设、域名、虚拟空间、网站托管、企业网站设计、谢通门网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

Dim querystring As String = "update 班级信息表 set 班级名称="TextBox1.Text",班级编号="TextBox2.Text""

改称这样试试:

Dim querystring As String

querystring = "update 班级信息表 set 班级名称=" chr(39) TextBox1.Text chr(39) ", 班级编号=" chr(39) TextBox2.Text chr(39)

vb.net查询语法

顺序应该是先Connection的Open

con.ConnectionString = constr

con.Open()

dc = New OleDbDataAdapter(sql, constr)

另外你的SQL语句好像有点问题,表名不加单引号

高分求.net里vb语法操作数据库基本语句

Dim Cnn As New Data.OleDb.OleDbConnection

Dim DbAdapter As New Data.OleDb.OleDbDataAdapter

Dim Cmd As New Data.OleDb.OleDbCommand

Dim dsAll As New Data.DataSet

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\webapp\test\web.mdb"

Cmd.Connection = Cnn

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

'插入

Cmd.CommandText = "insert into main (about) values ('" + TextBox1.Text + "')"

UpdateTable()

End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click

'修改

Dim ids As Integer

ids = 1

Cmd.CommandText = "update main set about='" + TextBox1.Text + "' where id=" + ids.ToString()

UpdateTable()

End Sub

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click

'删除

Dim ids As Integer

ids = 1

Cmd.CommandText = "delete from main where id=" + ids.ToString()

UpdateTable()

End Sub

Public Sub UpdateTable()

Dim Trans As Data.OleDb.OleDbTransaction

Try

Cnn.Open()

Trans = Cnn.BeginTransaction()

Try

Cmd.Transaction = Trans

Cmd.ExecuteNonQuery()

Trans.Commit()

Catch

Trans.Rollback()

Finally

If (Cnn.State = System.Data.ConnectionState.Open) Then

Cnn.Close()

End If

End Try

Catch

'error message

End Try

End Sub

Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click

'显示

Cmd.CommandText = "select id, about from main"

DbAdapter.SelectCommand = Cmd

DbAdapter.Fill(dsAll, "table1")

If (dsAll.Tables("table1").Rows.Count 0) Then

TextBox1.Text = dsAll.Tables("table1").Rows(0)("about")

Else

TextBox1.Text = ""

End If

End Sub


网站栏目:vb.net数据库语法 vbnet access数据库
标题网址:http://bjjierui.cn/article/doihcod.html

其他资讯