主题:问题
zrs797246
[专家分:190] 发布于 2005-11-13 16:45:00
请问哪位高手懂得将文本框中的内容读到SQL Server 2000数据库中??
给出语句的加满分
谢谢!!!
回复列表 (共5个回复)
沙发
williambolice [专家分:470] 发布于 2005-11-14 02:20:00
在你的命令按钮添加声明
cm.Parameters .Add ("@post_id",SqlDbType.Char);
然后把文本的值赋给参数值
cm.Parameters ["@post_id"].Value =TextBox1.Text.Trim();
板凳
shuiziliu [专家分:300] 发布于 2005-11-14 08:53:00
前端声明:
Public mOraConnect As OracleInProcServer.OraSession
Public mOraSession As OracleInProcServer.OraDatabase
Dim SAVE As String
Dim oDys As OracleInProcServer.OraDynaset
控制台:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
mOraConnect = CreateObject("OracleInProcServer.XOraSession")
mOraSession = mOraConnect.DbOpenDatabase("datasource", "user" + "/" + "password", 1)
mOraConnect.DbBeginTrans()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SAVE = ""
SAVE = SAVE & " INSERT INTO 表名(字段名)"
SAVE = SAVE & " VALUES( '"& TextBox1.Text & "')"
System.Diagnostics.Debug.Write(SAVE)
mOraSession.ExecuteSQL(SAVE)
mOraSession.CommitTrans()
3 楼
shuiziliu [专家分:300] 发布于 2005-11-14 09:26:00
imports system.data
imports system.data.sqlclient
Public constr As String = "provider=microsoft.jet.oledb.4.0;data source=e:\VB.NETziliao\publicdatabase\db1.mdb"
Public mycon As New OleDb.OleDbConnection(constr)
dim str1,str2 as string
str1="insert into 表名 (“字段名“
str2="values('"& textbox1.text &"'
str1 &= (") " & str2 & ") ")
Dim com As New OleDbCommand(str1, mycon)
mycon.Open()
com.ExecuteNonQuery()
mycon.Close()
4 楼
零点代码 [专家分:50] 发布于 2005-11-16 22:43:00
好文章值得看一下!
5 楼
零点代码 [专家分:50] 发布于 2005-11-18 20:45:00
好文章值得看一下!
我来回复