真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網站制作重慶分公司

vb.net更改字段名 vb 修改文件名

用VB.NET連接ACCESS取出ACCESS中的所有表名和字段名

Public conn As New ADODB.Connection

成都創(chuàng)新互聯(lián)是一家集網站建設,華安企業(yè)網站建設,華安品牌網站建設,網站定制,華安網站建設報價,網絡營銷,網絡優(yōu)化,華安網站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強企業(yè)競爭力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學習、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網站。

Public Rs As New ADODB.Recordset

Public db As String

Private sSQL As String

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

db = "C:\Documents and Settings\ws01\デスクトップ\新しいフォルダ\WindowsApplication1\db1.mdb"

db = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" db

conn.CursorLocation = ADODB.CursorLocationEnum.adUseClient

conn.Open(db)

Rs = conn.OpenSchema()

End Sub

菜鳥求教!VB.NET中ACCESS的UPDATE的語法問題

oledbcmd.CommandText = "select * from jsq" + “ update 表名 set 字段名=字段名+1 where 字段名2=值”

把UPDATE 語句直接接后面 記得空格就行了。。

而且后面也不用A+1

也不用去執(zhí)行UPDATE了。。

在用VB.NET語言編寫程序時,怎么樣把用英文定義的字段轉換成用中文的字段的代碼,具體的解決辦法?

啊是Datatable的么? 是的話 直接設置 dataTable.Columns("").ColumnName=你想要的

VB.Net 用Access數據庫,同樣是日期型字段,第一句可以更新,第二句不能更新,提示語法錯誤,什么原因?

你把這個字段名 Prepare 修改一下,這個名可能與VB.NET或者是ACCESS的保留字發(fā)生沖突了,改成 Prepare1 或者其它就可以。

vb.net數據庫操作

參考一下下面這段代碼就可以了。

Imports System.Data

'引入數據庫操作類命名空間

Imports System.Data.OleDb

'引入ADO.NET操作命名空間

Public Class FrmModifystInfo

Inherits System.Windows.Forms.Form

Public ADOcmd As OleDbDataAdapter

Public ds As DataSet = New DataSet()

'建立DataSet對象

Public mytable As Data.DataTable

'建立表單對象

Public myrow As Data.DataRow

'建立數據行對象

Public rownumber As Integer

'定義一個整型變量來存放當前行數

Public SearchSQL As String

Public cmd As OleDbCommandBuilder

'======================================================

#Region " Windows 窗體設計器生成的代碼 "

#End Region

'======================================================

Private Sub FrmModifystInfo_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

'窗體的載入

TxtSID.Enabled = False

TxtName.Enabled = False

ComboSex.Enabled = False

TxtBornDate.Enabled = False

TxtClassno.Enabled = False

TxtRuDate.Enabled = False

TxtTel.Enabled = False

TxtAddress.Enabled = False

TxtComment.Enabled = False '設置信息為只讀

Dim tablename As String = "student_Info "

SearchSQL = "select * from student_Info "

ExecuteSQL(SearchSQL, tablename) '打開數據庫

ShowData() '顯示記錄

End Sub

Private Sub ShowData()

'在窗口中的textbox中顯示數據

myrow = mytable.Rows.Item(rownumber)

TxtSID.Text = myrow.Item(0).ToString

TxtName.Text = myrow.Item(1).ToString

ComboSex.Text = myrow.Item(2).ToString

TxtBornDate.Text = Format(myrow.Item(3), "yyyy-MM-dd ")

TxtClassno.Text = myrow.Item(4).ToString

TxtTel.Text = myrow.Item(5).ToString

TxtRuDate.Text = Format(CDate(myrow.Item(6)), "yyyy-MM-dd ")

TxtAddress.Text = myrow.Item(7).ToString

TxtComment.Text = myrow.Item(8).ToString

End Sub

Private Sub BtFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtFirst.Click

'指向第一條數據

rownumber = 0

ShowData()

End Sub

Private Sub BtPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtPrev.Click

'指向上一條數據

BtNext.Enabled = True

rownumber = rownumber - 1

If rownumber 0 Then

rownumber = 0 '如果到達記錄的首部,行號設為零

BtPrev.Enabled = False

End If

ShowData()

End Sub

Private Sub BtNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtNext.Click

'指向上一條數據

BtPrev.Enabled = True

rownumber = rownumber + 1

If rownumber mytable.Rows.Count - 1 Then

rownumber = mytable.Rows.Count - 1 '判斷是否到達最后一條數據

BtNext.Enabled = False

End If

ShowData()

End Sub

Private Sub BtLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtLast.Click

'指向最后一條數據

rownumber = mytable.Rows.Count - 1

ShowData()

End Sub

Private Sub BtDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtDelete.Click

mytable.Rows.Item(rownumber).Delete() '刪除記錄

If MsgBox( "確定要刪除改記錄嗎? ", MsgBoxStyle.OKCancel + vbExclamation, "警告 ") = MsgBoxResult.OK Then

cmd = New OleDbCommandBuilder(ADOcmd)

'使用自動生成的SQL語句

ADOcmd.Update(ds, "student_Info ")

BtNext.PerformClick()

End If

End Sub

Private Sub BtModify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtModify.Click

TxtSID.Enabled = False '關鍵字段只讀

TxtName.Enabled = True '可讀寫

ComboSex.Enabled = True

TxtBornDate.Enabled = True

TxtClassno.Enabled = True

TxtRuDate.Enabled = True

TxtTel.Enabled = True

TxtAddress.Enabled = True

TxtComment.Enabled = True

End Sub

Private Sub BtUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtUpdate.Click

If Not Testtxt(TxtName.Text) Then

MsgBox( "請輸入姓名! ", vbOKOnly + vbExclamation, "警告 ")

TxtName.Focus()

Exit Sub

End If

If Not Testtxt(ComboSex.Text) Then

MsgBox( "請選擇性別! ", vbOKOnly + vbExclamation, "警告 ")

ComboSex.Focus()

Exit Sub

End If

If Not Testtxt(TxtClassno.Text) Then

MsgBox( "請選擇班號! ", vbOKOnly + vbExclamation, "警告 ")

TxtClassno.Focus()

Exit Sub

End If

If Not Testtxt(TxtTel.Text) Then

MsgBox( "請輸入聯(lián)系電話! ", vbOKOnly + vbExclamation, "警告 ")

TxtTel.Focus()

Exit Sub

End If

If Not Testtxt(TxtAddress.Text) Then

MsgBox( "請輸入家庭住址! ", vbOKOnly + vbExclamation, "警告 ")

TxtAddress.Focus()

Exit Sub

End If

If Not IsNumeric(Trim(TxtSID.Text)) Then

MsgBox( "請輸入數字學號! ", vbOKOnly + vbExclamation, "警告 ")

Exit Sub

TxtSID.Focus()

End If

If Not IsDate(TxtBornDate.Text) Then

MsgBox( "出生時間應輸入日期格式(yyyy-mm-dd)! ", vbOKOnly + vbExclamation, "警告 ")

Exit Sub

TxtBornDate.Focus()

End If

If Not IsDate(TxtRuDate.Text) Then

MsgBox( "入校時間應輸入日期格式(yyyy-mm-dd)! ", vbOKOnly + vbExclamation, "警告 ")

TxtRuDate.Focus()

Exit Sub

End If

myrow.Item(0) = Trim(TxtSID.Text)

myrow.Item(1) = Trim(TxtName.Text)

myrow.Item(2) = Trim(ComboSex.Text)

myrow.Item(3) = Trim(TxtBornDate.Text)

myrow.Item(4) = Trim(TxtClassno.Text)

myrow.Item(5) = Trim(TxtTel.Text)

myrow.Item(6) = Trim(TxtRuDate.Text)

myrow.Item(7) = Trim(TxtAddress.Text)

myrow.Item(8) = Trim(TxtComment.Text)

mytable.GetChanges()

cmd = New OleDbCommandBuilder(ADOcmd)

'使用自動生成的SQL語句

ADOcmd.Update(ds, "student_Info ")

'對數據庫進行更新

MsgBox( "修改學籍信息成功! ", vbOKOnly + vbExclamation, "警告 ")

TxtName.Enabled = False

ComboSex.Enabled = False

TxtBornDate.Enabled = False

TxtClassno.Enabled = False

TxtRuDate.Enabled = False

TxtTel.Enabled = False

TxtAddress.Enabled = False

TxtComment.Enabled = False '重新設置信息為只讀

End Sub

Private Sub BtCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtCancel.Click

TxtSID.Enabled = False

TxtName.Enabled = False

ComboSex.Enabled = False

TxtBornDate.Enabled = False

TxtClassno.Enabled = False

TxtRuDate.Enabled = False

TxtTel.Enabled = False

TxtAddress.Enabled = False

TxtComment.Enabled = False

End Sub

Public Function ExecuteSQL(ByVal SQL As String, ByVal table As String)

Try

'建立ADODataSetCommand對象

'數據庫查詢函數

ADOcmd = New OleDbDataAdapter(SQL, "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\student.mdb ")

'建立ADODataSetCommand對象

ADOcmd.Fill(ds, table) '取得表單

mytable = ds.Tables.Item(0) '取得名為table的表

rownumber = 0 '設置為第一行

myrow = mytable.Rows.Item(rownumber)

'取得第一行數據

Catch

MsgBox(Err.Description)

End Try

End Function

End Class


分享標題:vb.net更改字段名 vb 修改文件名
分享鏈接:http://weahome.cn/article/doodjji.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部