麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 數據庫 > Access > 正文

ACCESS數據庫訪問組件(二)

2024-09-07 19:05:00
字體:
來源:轉載
供稿:網友
access數據庫訪問組件(二)access_table.cs

using system;

namespace xlang.videoonline.framework.database.access
{
/// <summary>
/// summary description for access_datatable.
/// </summary>
public class datatable:system.data.datatable
{
private string _tablename;

private string _primarykey;

public string name
{
get { return _tablename; }
set { _tablename=value; }
}


public string primarykey
{
get { return _primarykey; }
set { _primarykey=value; }
}


public datatable()
{
}


public datatable(string tablename)
{
_tablename=tablename;
}


public string createcommand(database.access.datarow[] rows)
{
string temp="create table "+_tablename+"(";
for(int i=0;i<rows.getlength(0);i++)
{
temp+="["+rows[i].name+"] "+rows[i].type+(rows[i].isnull? ",":" not null,");
}
temp+="constraint [index1] primary key (["+rows[0].name+"]))";
_primarykey=rows[0].name;
return temp;
}


public string insertcommand(database.access.datarow[] rows)
{
string temp="";
temp="insert into "+_tablename+" ( ";
for(int i=0;i<rows.getlength(0);i++)
{
temp+="["+rows[i].name+"] "+",";
}
temp=temp.substring(0,temp.length-1);
temp+=") values(";
for(int i=0;i<rows.getlength(0);i++)
{
if(rows[i].type.equals("boolean"))
temp+=((rows[i].value.tostring().toupper().equals("yes"))? "yes":"no")+",";
else if(rows[i].type.startswith("string")||rows[i].type.equals("memo")||
rows[i].type.equals("text")||rows[i].type.startswith("text"))
temp+="'"+rows[i].value+"',";
else if(rows[i].type.equals("date"))
temp+="#"+rows[i].value+"#,";
else
temp+=rows[i].value+",";
}
temp=temp.substring(0,temp.length-1);
temp+=")";
return temp;
}


public string deletecommand()
{
return "drop table "+_tablename;
}


public string deletecommand(string conditions)
{
return "delete * from "+_tablename+" where "+conditions;
}


public string updatecommand(database.access.datarow[] rows,string conditions)
{
string temp="update "+_tablename+" set ";
temp+=prosessdifferentdatatype(rows);
temp+=" where "+conditions;
return temp;
}


public string selectcommand()
{
return "select * from "+_tablename;
}


public string selectcommand(string conditions)
{
return "select * from "+_tablename +" where "+conditions;
}


public string selectcommand(database.access.datarow[] rows,string conditions)
{
string temp="select ";
for(int i=0;i<rows.getlength(0);i++)
{
temp+="["+rows[i].name+"],";
}
temp=temp.substring(0,temp.length-1);
temp+=" from "+_tablename+" where "+conditions;
return temp;
}


public string joincommand(database.access.datarow[] rows,string condition,params string [] tablenames)
{
string temp="select ";
for(int i=0;i<rows.getlength(0);i++)
{
temp+="["+rows[i].name+"],";
}
temp=temp.substring(0,temp.length-1);
// temp+=" from "+_tablename+" where "+conditions;
temp+=" from ";
foreach(string table in tablenames)
temp+=table+",";
temp=temp.substring(0,temp.length-1);

if(condition!=null)
temp+=" where "+condition;

return temp;
}


private string prosessdifferentdatatype(database.access.datarow[] rows)
{
string temp="";
for(int i=0;i<rows.getlength(0);i++)
{
if(rows[i].type.equals("boolean"))
temp+="["+rows[i].name+"] ="+
((rows[i].value.tostring().toupper().equals("yes"))? "yes":"no")
+",";
else if(rows[i].type.startswith("string")||rows[i].type.equals("memo")||
rows[i].type.equals("text")||rows[i].type.startswith("text"))
temp+="["+rows[i].name+"] ='"+rows[i].value+"',";
else if(rows[i].type.equals("date"))
temp+="["+rows[i].name+"] =#"+rows[i].value+"#,";
else
temp+="["+rows[i].name+"] ="+rows[i].value+",";

}
temp=temp.substring(0,temp.length-1);
return temp;
}
}
}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 欧美三日本三级少妇三级99观看视频 | 亚洲精品午夜国产va久久成人 | 素人视频在线观看免费 | 一级毛片播放 | 久久国产精品久久精品国产演员表 | 国内成人自拍视频 | 蜜桃免费在线 | 国产chinesehd精品91 | 久久国产精品99国产 | 国产色视频在线观看免费 | 国产免费最爽的乱淫视频a 毛片国产 | 日本中文不卡视频 | 最新中文字幕在线 | 久久狠狠高潮亚洲精品 | 日韩欧美高清片 | 成人片免费视频 | 激情大乳女做爰办公室韩国 | 精品黑人一区二区三区国语馆 | 久久草在线视频国产 | 色女人在线 | 日本a在线观看 | 久久91精品久久久久清纯 | 国产精品免费久久久久 | 蜜桃视频在线免费播放 | 久久大陆 | 黄色大片在线免费观看 | 久久久成人999亚洲区美女 | 一级做a爱片久久 | av电影网在线观看 | 欧美韩国日本在线 | 激情小说激情电影 | 亚洲人成免费 | 中文字幕一区久久 | 久久精品久久精品国产大片 | 国产一区日韩精品 | 欧美特黄特色视频 | 另类亚洲孕妇分娩网址 | 中国国语毛片免费观看视频 | 久久激情小视频 | 91精品国产乱码久 | 精精国产xxxx视频在线野外 |