欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
INI文件格式及其操作代碼

INI文件格式及其操作代碼

INI文件格式如下: 
[Database] 
server=wlq 
database=mydatabase 
uid=sa 
pwd=123456

說(shuō)明:(有4個(gè)key) 
Section為:Database 
Key為:server database uid pwd

/***************代碼******************/ 
using System; 
using System.IO; 
using System.Runtime.InteropServices; 
using System.Text;


namespace Sx_Mdi 
{

/// <summary> 
/// Summary description for Class1. 
/// </summary> 
public class IniFile 

//文件INI名稱(chēng) 
public string Path;

////聲明讀寫(xiě)INI文件的API函數 
[DllImport("kernel32")]

private static extern long WritePrivateProfileString(string section,string key,string val,string filePath);


[DllImport("kernel32")]

private static extern int GetPrivateProfileString(string section,string key,string def,StringBuilder retVal,int size,string filePath);


//類(lèi)的構造函數,傳遞INI文件名 
public IniFile(string inipath) 

// 
// TODO: Add constructor logic here 
// 
Path = inipath; 
}

//寫(xiě)INI文件 
public void IniWriteValue(string Section,string Key,string Value) 

WritePrivateProfileString(Section,Key,Value,this.Path);

}

//讀取INI文件指定 
public string IniReadValue(string Section,string Key) 

StringBuilder temp = new StringBuilder(255); 
int i = GetPrivateProfileString(Section,Key,"",temp,255,this.Path); 
return temp.ToString();

}



}

操作范例:

public static SqlConnection MyConnection() 

string sPath; 
string ServerName,userId,sPwd,DataName;

sPath = GetPath(); 
IniFile ini = new IniFile(sPath); 
ServerName = ini.IniReadValue ("Database","server"); 
userId = ini.IniReadValue ("Database","uid"); 
sPwd = ini.IniReadValue ("Database","pwd"); 
DataName = ini.IniReadValue ("Database","database"); 
string strSql = "server =" + ServerName+";uid ="+ userId +";pwd =;database ="+ DataName; 
    SqlConnection myConn=new SqlConnection(strSql); 
    return myConn; 
}

/***************代碼******************/

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
C#實(shí)現對SQL數據庫中的表的查詢(xún)、添加、修改、刪除數據
c#中如何將數據庫中一個(gè)表的某列顯示在組合框控件的下拉菜單中?
ASP.NET下備份與還原數據庫代碼
SqlConnection類(lèi)
「筆記」使用ADO.NET訪(fǎng)問(wèn)數據庫,進(jìn)行增刪改查
數據庫連接文件
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久