日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > asp.net >内容正文

asp.net

使用VB 6.0使用XML和文本文件进行数据管理:第一部分

發布時間:2023/12/20 asp.net 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用VB 6.0使用XML和文本文件进行数据管理:第一部分 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

續自: http : //www.thescripts.com/forum/thread762010.html

-VB 6.0專業版

-Microsoft DAO 3.6參考

搜索數據庫表...

嘗試獲取Access中存儲的數據:

(1)該程序嘗試在Access數據庫中搜索實際數據

(2)用5個文本字段構建一個Access數據庫表

(3)閱讀下面的代碼,添加以Your_Price開頭的這些字段作為名稱

(4)每個字段必須與VB中此處顯示的字段名稱相對應

(5)必須有5個文本框的數組,第一個文本行Text1(0).Text

(6)您將需要一個精美的命令按鈕,名為“ Seek”

(7)添加Microsoft DAO 3.6對象庫

(8)在下面添加代碼...

Option?Explicit Option?Base?1?'this?option?makes?it?that?the?program?starts?at?number?1,?always... Dim?io()?As?String?'dimensioning?for?array?to?return?values Dim?prs_calc?As?Integer?'dimensioning?to?record?person?instances Dim?ndvdl,?filenum1?As?Integer?'dimensioning?to?record?instances?for?each?instance?of?a?person Dim?my_string?As?String 'Your?input?box?for?instances?being?entered 'Your?buttons?will?disapear?depending?on?number?added?in?for?each?entry Private?Sub?Form_Load() ndvdl?=?Int(InputBox("Add?a?number?to?box?to?continue",?"Data?Mining?Required?Info",?1))?'this?is?the?pop-up?box?for?entry?of?persons?by?the?user? 'making?sure?only?digits?are?entered If?IsNumeric(ndvdl)?=?False?ThenMsgBox?("Please?add?numeric?data?to?continue...")'LoadTFile.Visible?=?FalseElse?'If?IsNumeric(Text3.Text)?=?True?Then? ReDim?io(ndvdl,?5)??'redimensioned?for?the?purpose?of?data?rows?calculatorprs_calc?=?1End?If End?Sub? 'this?is?searching?for?existing?data?in?local?Access?database Private?Sub?Seek_Click() Dim?my_database?As?Database???????????'dimension?database?as?database?so?program?knows?where?to?look?for?data Dim?my_record?As?Recordset Dim?test?As?String test?=?Text1(1).Text Set?my_database?=?OpenDatabase("C:\DataGram\Data_Central.mdb")???'this?function?will?open?the?database?using?the?link?to?the?access?database?(provided?that?it?is?closed?access) Set?my_record?=?my_database.OpenRecordset("SELECT?*?FROM?LIBRARY?WHERE?Your_Price?LIKE?'"?&?Text1(0).Text?&?"'")????'?this?is?used?to?search?by?name,?only?if?data?already?existsDo?While?Not?my_record.EOF??'this?function?will?keep?searching?for?fields?matching?each?textbox'MsgBox?("got?here")Text1(0).Text?=?my_record.fields("Your_Price")Text1(1).Text?=?my_record.fields("Name")Text1(2).Text?=?my_record.fields("Type")Text1(3).Text?=?my_record.fields("Crime_Rate_1")Text1(4).Text?=?my_record.fields("Crime_Rate_2")??????my_record.MoveNextLoopmy_database.Close End?Sub??提示:下載SQL Server Management Studio Express,以管理來自ASP.NET/SQL DB的數據: http : //www.thescripts.com/forum/thread762010.html

SQL Server Management Studio Express可幫助將在那里收集的數據加載到本地Access DB,反之亦然。

SQL Server Management Studio Express有助于查詢構建。 使用查詢生成器(適當命名)可以查詢Access數據庫和其他數據庫。

SQL Server管理工具對于VB / VBA必須可用以進行進一步觀察的數據至關重要。 請下載SQL Server Management Studio,以使數據可用于VB / VBA應用程序

http://www.microsoft.com/downloads/d...displaylang=zh-CN

-VB 6.0專業版

-Microsoft DAO 3.6參考

添加到數據庫表...

嘗試向Access數據庫提交數據:

(1)該程序嘗試向Access數據庫添加,刪除,更新數據

(2)用5個文本字段構建一個Access數據庫表

(3)閱讀下面的代碼,添加以Your_Price開頭的這些字段作為名稱

(4)每個字段必須與VB中此處顯示的字段名稱相對應

(5)必須有5個文本框的數組,第一個文本行Text1(0).Text

(6)您將需要一個精美的命令按鈕,名為“ Seek”

(7)添加Microsoft DAO 3.6對象庫

(8)在下面添加代碼...

? Private?Sub?subt_Click()???'this?function?will?load?entry?into?database 'dim?as?database?to?allow?vb?to?interact?with?Access?database?seemlessly...Dim?my_database?As?Database 'open?database?to?allow?vb?to?add?data?to?Access?database?seemlessly...Set?my_database?=?OpenDatabase("C:\DataGram\Data_Central.mdb") 'run?insert?statement?query?that?will?load?data?to?your?databasemy_database.Execute?"insert?into?Data_Central.LIBRARY(Your_Price,?Name,?Type,?Crime_Rate_1,?Crime_Rate_2)?Values('"?&?Text1(0).Text?&?"','"?&?Text1(1).Text?&?"'?,?'"?&?Text1(2).Text?&?"'?,?'"?&?Text1(3).Text?&?"','"?&?Text1(4).Text?&?"')"my_database.Close 'this?variable?serves?to?emptying?your?textboxes,?part?of?reset?buttonR_Click? End?Sub??從數據庫中刪除數據... ? Private?Sub?dll_Click() 'dim?as?database?to?allow?vb?to?interact?with?Access?database?seemlessly... Dim?my_database?As?Database 'dim?as?Recordset?to?allow?vb?to?interact?with?Access?database?seemlessly... Dim?my_record?As?Recordset 'open?database?to?allow?vb?to?delete?data?from?Access?database?seemlessly... Set?my_database?=?OpenDatabase("C:\DataGram\Data_Central.mdb") 'run?delete?statement?query?that?will?remove?data?from?your?database Set?my_record?=?my_database.OpenRecordset("select?*?from?LIBRARY?where?Your_Price='"?&?Text1(0).Text?&?"'") If?Not?my_record.EOF?Then my_record.Delete End?If my_database.Close 'variable?that?should?empty?textboxes?for?future?instances... R_Click? End?Sub??更新數據庫中的數據... ? Private?Sub?Updt_Click() 'dim?as?database?to?allow?vb?to?interact?with?Access?database?seemlessly... Dim?my_database?As?Database 'dim?as?Recordset?to?allow?vb?to?interact?with?Access?database?seemlessly... Dim?my_record?As?Recordset 'run?a?little?check?to?see?if?proper?credentials?are?added?before?releasing?info... If?(Text1(0)?=?"")?Then MsgBox?("Please?put?in?Your?price..."),?vbOKOnly,?"Data?Mining?Error" ElseIf?(Text1(1)?=?"")?Then MsgBox?("Please?put?in?Item?name..."),?vbOKOnly,?"Data?Mining?Error" Else 'open?database?to?allow?vb?to?update?data?to?Access?database?seemlessly... Set?my_database?=?OpenDatabase("C:\DataGram\Data_Central.mdb") 'run?update?statement?query?that?will?modify?data?to?your?database Set?my_record?=?my_database.OpenRecordset("SELECT?*?FROM?LIBRARY?WHERE?Your_Price='"?&?Text1(0).Text?&?"'") my_record.Editmy_record!Your_Price?=?Text1(0).Textmy_record!Name?=?Text1(1).Textmy_record!Type?=?Text1(2).Textmy_record!Crime_Rate_1?=?Text1(3).Textmy_record!Crime_Rate_2?=?Text1(4).Text? my_record.Update my_record.Close my_database.Close? End?If? End?Sub??清除您的文本框... Private?Sub?R_Click()?'this?must?clear?the?textbox?upon?entry?of?all?dataText1(0).Text?=?""??????Text1(1).Text?=?""Text1(2).Text?=?""Text1(3).Text?=?""Text1(4).Text?=?""? Text1(0).SetFocus???????'this?should?set?index?back?to?first?textbox End?Sub?接下來將數據轉換為XML文件...

-添加Microsoft XML v 3.0

-在下面添加代碼

續自:

http://www.thescripts.com/forum/thread777267.html

-VB 6.0專業版

-Microsoft XML v3.0參考

將訪問數據轉換為XML文件...

嘗試將數據從Access數據庫轉換為XML:

(1)該程序嘗試將Access數據轉換為XML

(2)使用現有數據庫表,加載上面的代碼

(4)每個字段必須與VB中此處顯示的字段名稱相對應

(5)您將需要一個精美的命令按鈕,名為“ Seek”

(6)在參考資料中添加Microsoft XML v3.0對象庫

(7)添加Microsoft DAO 3.6對象庫

(8)在下面添加代碼...

?? Private?Sub?CreateXMFile_Click() 'dim?as?database?to?allow?vb?to?interact?with?Access?database?seemlessly... Dim?my_database?As?Database 'dim?as?Recordset?to?allow?vb?to?interact?with?Access?database?seemlessly... Dim?objRS?As?Recordsetdimension?your?FreeFileDim?intFreeFile 'open?database?to?allow?vb?to?grab?data?from?Access?database?seemlessly...????Set?my_database?=?OpenDatabase("C:\DataGram\Data_Central.mdb") 'run?query?that?will?collect?data?from?your?databaseSet?objRS?=?my_database.OpenRecordset("SELECT?Your_Price,?Name,?Type,?Crime_Rate_1,?Crime_Rate_2?From?LIBRARY") intFreeFile?=?FreeFile Open?App.Path?+?"\App_Price.xml"?For?Output?As?#intFreeFile? 'build?XML?version?number,?and?print?column?names?for?readibility... Print?#intFreeFile,?"<?xml?version="?&?Chr(34)?&?"1.0"?&?Chr(34)?&?"?>" Print?#intFreeFile,?"<!--??File?Name:?App_Price.xml?-->"? 'printing?out?nodes?and?subnodes?with?data?gathered?from?database... Print?#intFreeFile,?"<Find_It>"?Do?While?Not?objRS.EOFPrint?#intFreeFile,?"<Apartmnt>"Print?#intFreeFile,?"<Your_Price>"?&?objRS.fields("Your_Price")?&?"</Your_Price>"?_&?vbCrLf?&?"<Name>"?&?objRS.fields("Name")?&?"</Name>"?&?vbCrLf?&?"<Type>"?&?objRS.fields("Type")?&?"</Type>"?_&?vbCrLf?&?"<Crime_Rate_1>"?&?objRS.fields("Crime_Rate_1")?&?"</Crime_Rate_1>"?_&?vbCrLf?&?"<Crime_Rate_2>"?&?objRS.fields("Crime_Rate_2")?&?"</Crime_Rate_2>"Print?#intFreeFile,?"</Apartmnt>"objRS.MoveNextLoop? Print?#intFreeFile,?"</Find_It>"?objRS.CloseSet?objRS?=?NothingClose?intFreeFileMsgBox?("What?do?you?know,?you?have?an?XML?file!") 'depending?on?number?of?instances?added?in?input?box?upon?entry,? 'you?will?have?x?amount?of?instances?to?enter,?browse?data?through?this?application.??Button?disappears?after?your?max?has?been?reached:-)??If?(prs_calc?=?ndvdl)?Then?????'this?logic?will?take?away?button?CreateXMFile?if?limit?has?been?reachedCreateXMFile.Visible?=?FalseEnd?If End?Sub??參見下一個: http : //bytes.com/forum/thread777278.html

-VB 6.0專業版

-Microsoft DAO 3.6參考

正在將訪問數據轉換為TEXT文件...

嘗試將數據從Access數據庫轉換為.txt文件:

(1)該程序嘗試將Access數據轉換為TEXT文件

(2)使用上面代碼中的現有數據庫表

(3)每個字段必須與VB中此處顯示的字段名稱相對應

(4)您將需要一個精美的命令按鈕,該按鈕的名稱為“ Seek”

(5)添加Microsoft DAO 3.6對象庫

(6)在下面添加代碼...

? Private?Sub?CreateTXTfile_Click() 'dim?as?database?to?tell?vb?we're?using?an?Access?database Dim?my_database?As?Database? 'dim?as?Recordsetto?tell?vb?we're?using?an?Access?database?Recordset Dim?objRS?As?Recordset 'add?FreeFile?so?vb?creates?one?locallyDim?intFreeFile? 'open?the?database?to?grab?dataSet?my_database?=?OpenDatabase("C:\DataGram\Data_Central.mdb")? 'open?the?Recordset?to?grab?rows?in?a?querySet?objRS?=?my_database.OpenRecordset("SELECT?Your_Price,?Name,?Type,?Crime_Rate_1,?Crime_Rate_2?From?LIBRARY") 'initiating?FreeFile...intFreeFile?=?FreeFile Open?App.Path?+?"\App_Price.txt"?For?Output?As?#intFreeFile? 'Print?column?names?for?readibility Print?#intFreeFile,?"Your_Price"?&?vbTab?&?"Name"?&?vbTab?&?"Type"?&?vbTab?&?"Crime_Rate_1"?&?vbTab?&?"Crime_Rate_2"? 'run?through?database?recordset?until?all?data?gathered?to?create?TEXT?file...???Do?While?Not?objRS.EOF?Print?#intFreeFile,?objRS.fields("Your_Price")?&?vbTab?_&?objRS.fields("Name")?&?vbTab?&?objRS.fields("Type")?&?vbTab?_&?objRS.fields("Crime_Rate_1")?&?vbTab?_&?objRS.fields("Crime_Rate_2")?objRS.MoveNextLoop?'remember?to?do?this...objRS.Close'IMPORTANT?to?do?this?to?allow?database?to?properly?closeSet?objRS?=?Nothing?'primitive?way?of?clearing?textboxes,?you?can?do?better?here'do?it?with?a?for?loopText1(0).Text?=?""Text1(1).Text?=?""Text1(2).Text?=?""Text1(3).Text?=?""Text1(4).Text?=?""??'return?to?first?textbox?to?continue?searching,?or?otherText1(0).SetFocus?MsgBox?("What?do?you?know,?you?have?Text?file(s)!")? 'close?the?file?after?you?create?it...???? Close?intFreeFile? End?Sub??正在加載數據新創建的文件...

這有點不同。 有必要添加一個文本框來記錄要從多維數組返回的值的數量:

(1)需要一個記錄計數器來保持每個用戶的實例程序負載

(2)還需要一個輸入框來記錄您的條目的實例

? Private?Sub?LoadTFile_Click()'this?collection?button?serves?to?redeeming?all?data?written?to?file'to?be?inputted?back?into?program,?dimensioning?data?and?renaming?them?as?"Info"'Info1,2,3?and?so?on?represent?io?array?1,2,3?so?on?and?so?forthDim?my_string?As?StringDim?Info1?As?StringDim?Info2?As?StringDim?Info3?As?StringDim?Info4?As?StringDim?Info5?As?String'Dim?Info6?As?String'Dim?Info7?As?String'Dim?Info8?As?String?Dim?record_cntr,?location_cntr?As?IntegerDim?user_req?As?IntegerDim?bombDim?test_string?As?StringDim?X?As?Integer?'x?is?a?counterDim?my_char?As?String??Text1(0).Text?=?Info1Text1(1).Text?=?Info2Text1(2).Text?=?Info3Text1(3).Text?=?Info4Text1(4).Text?=?Info5'Text1(5).Text?=?Info1'Text1(6).Text?=?Info1'Text1(7).Text?=?Info1????test_string?=?Text3.Text'test_l?=?Len(test_string)Do?While?X?<?10my_char?=?InStr(X,?test_string)Select?Case?my_charCase?"1"Case?"2"Case?"3"Case?"4"Case?"5"Case?"6"Case?"7"Case?"8"Case?"9"Case?"0"Case?ElseMsgBox?("You?must?enter?a?number!")bomb?=?99999End?SelectX?=?X?+?1Loop?If?IsNumeric(Text3.Text)?=?False?ThenMsgBox?("Please?add?numeric?data?to?continue...")'LoadTFile.Visible?=?FalseElse?'If?IsNumeric(Text3.Text)?=?True?Then??If?(bomb?<>?99999)?Then?user_req?=?Int(Text3.Text)record_cntr?=?1??filenum1?=?FreeFileOpen?App.Path?+?"\App_Price.txt"?For?Input?As?#filenum1????????'file?is?opened?as?input?because?it?is?putting?back?into?the?program??Do?While?Not?EOF(filenum1)????????????????????????????????????'this?do?while?will?work?until?the?end?of?the?file...otherwise?it?will?keep?goingInput?#filenum1,?Info1,?Info2,?Info3,?Info4,?Info5?',?Info6,?Info7,?Info8record_cntr?=?record_cntr?+?1LoopClose?filenum1??If?record_cntr?<?user_req?ThenMsgBox?("There?are?only?"?&?(record_cntr?-?1)?&?"?records?in?file,?we?will?show?you?all?records.")End?If?Open?App.Path?+?"\App_Price.txt"?For?Input?As?#filenum1????????'file?is?opened?as?input?because?it?is?putting?back?into?the?program?location_cntr?=?1Do?While?Not?EOF(filenum1)????????????????????????????????????'this?do?while?will?work?until?the?end?of?the?file...otherwise?it?will?keep?goingInput?#filenum1,?Info1,?Info2,?Info3,?Info4,?Info5?',?Info6,?Info7,?Info8'all?info?in?textbox?bellow?will?come?through?line?by?line?using?"my_string.....+vbcrlf"If?(location_cntr?>=?(record_cntr?-?user_req))?Thenmy_string?=?my_string?+?Info1?+?vbCrLf?+?Info2?+?vbCrLf?+?Info3?+?vbCrLf?+?Info4?+?vbCrLf?+?Info5?+?vbCrLfEnd?Iflocation_cntr?=?location_cntr?+?1Loop?Close?filenum1Text2.Text?=?my_string????'this?text?box?return?all?data?which?have?been?recalled?from?file?on?harddrive?or?disk?? If?(prs_calc?=?ndvdl)?Then?????'this?logic?will?take?away?button?add?if?limit?has?been?reachedLoadTFile.Visible?=?FalseEnd?If End?If End?If End?Sub??
添加的信息:

-現有的record_cntr也需要一個用戶計數器

-record_cntr和user_req計數器允許按特定編號進行搜索

-添加了location_cntr以查明新添加條目的確切位置

-location_cntr查找數據的位置并記錄計數器加載數

-前面提到的文本框將保存返回所需的條目數

示例:如果在文本框中添加1,則多維數組中的一行為

回。 2、3等可能會產生結果

注意:使用ASP.NET代碼創建了管理員或超級用戶頁面,以將數據加載到SQL Server數據庫中。 現在,該數據將被加載到用戶定義的網站上以進行瀏覽。 通過VB / VBA進行數據管理,可以將XML / XSL和/或文本數據加載到以下HTML / JavaScript驅動的網站: http : //bytes.com/forum/thread672308.html

From: https://bytes.com/topic/visual-basic/insights/777267-data-management-xml-text-files-using-vb-6-0-part-one

總結

以上是生活随笔為你收集整理的使用VB 6.0使用XML和文本文件进行数据管理:第一部分的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。