很多,最简单的一种,就像ADO一样用oledbcommand,如下为插入数据: Dim conn As New OleDbConnection With conn
.ConnectionString = ConnctionString
.Open()
End With 'execute the sql
strSql = "INSERT INTO ORDERET(OrderId, Company, Customer, CustManager, TotalQty, SaleType) VALUES ('0001', '" & Company & "', '" & Customer & "', '" & CustManager & "'," & TotalQty & "5, '" & SaleType & "')"
With cmd
.Connection = conn
.CommandType = CommandType.Text
.CommandText = strSql
.ExecuteNonQuery()
End With
cmd.Dispose()
.ConnectionString = ConnctionString
.Open()
End With 'execute the sql
strSql = "INSERT INTO ORDERET(OrderId, Company, Customer, CustManager, TotalQty, SaleType) VALUES ('0001', '" & Company & "', '" & Customer & "', '" & CustManager & "'," & TotalQty & "5, '" & SaleType & "')"
With cmd
.Connection = conn
.CommandType = CommandType.Text
.CommandText = strSql
.ExecuteNonQuery()
End With
cmd.Dispose()
解决方案 »
- 如何向动态生成的HTML页面插入Javascript代码?详情见内
- gridview cells 取值的问题(急) <PagerTemplate>
- 怎嘛把sql2005的数据导出成Execl,在线等
- 向上帝提问:神啦,救救我吧!
- 最近给公司做的一个OA项目,大家批批
- asp.net怎么实现TextBox内容改变立即触发事件(特殊情况)
- 如何恢复数据库 急啊!!!! 我把数据库从sqlserver中误删了
- Select 标签中怎样增加option??
- 表格控件
- oledb不支持连接字符串
- 请教有关字体颜色的问题??
- <asp:Button id="btnHello" runat="server" Text="Click Heree" OnClick="button_click" />有错吗
Dim cn As OleDbConnection = New OleDbConnection(constr) Dim sqlstr As String = "insert into xiangmubiao(title,introduce,leibie) values(?,?,?)"
Dim cmd As OleDbCommand = New OleDbCommand(sqlstr, cn) cmd.Parameters.Add("title", OleDbType.VarChar, 32, "title")
cmd.Parameters.Add("sbody", OleDbType.VarChar, 5000, "sbody")
cmd.Parameters.Add("leibie", OleDbType.VarChar, 32, "leibie") cmd.Parameters("title").Value = title.Text
cmd.Parameters("sbody").Value = sBody.Text
cmd.Parameters("leibie").Value = leibie.SelectedItem.Value Try
cn.Open()
cmd.ExecuteNonQuery()
title.Text = ""
title.Text = ""
Response.Redirect("ok.aspx")
Response.End() Catch ex As Exception
Response.Write(ex.Message)
Response.End() Finally
If cn.State = ConnectionState.Open Then
cn.Close() End If
End Try这是我正写的一个提交程序,呵,,