📄 selectstatement.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
namespace rsgl.baseClass1
{
public class selectStatement
{
private string tableName;
private string tempTableName;
private baseClass1.whereStatement wheresql;
public selectStatement()
{
wheresql = new whereStatement();
}
public selectStatement(string tableName)
{
wheresql = new whereStatement();
this.tableName = tableName;
}
public selectStatement(string TableName, string tempTableName)
{
wheresql = new whereStatement();
this.tableName = TableName;
this.tempTableName = tempTableName;
}
public string selectSql()
{
StringBuilder selectsql = new StringBuilder("select * ");
selectsql.Append(" from "+tableName);
return selectsql.ToString();
}
public string selectSql(tableInfo[] tableinfos, string[] searchTypes, string[] status, bool isMulti)
{
StringBuilder selectsql = new StringBuilder("select * ");
selectsql.Append(" from " + tableName);
selectsql.Append(" " + wheresql.whereSql(tableinfos, searchTypes, status, isMulti));
return selectsql.ToString();
}
public string selectSql(string [] columnNames)
{
StringBuilder selectsql = new StringBuilder("select ");
for (int i = 0; i < columnNames.Length; i++)
{
selectsql.Append(columnNames[i] + ",");
}
selectsql.Remove(selectsql.Length - 1, 1);
selectsql.Append(" from " + tableName);
return selectsql.ToString();
}
public string selectSql(string[] columnNames, string[] columnTitles)
{
StringBuilder selectsql = new StringBuilder("select ");
for (int i = 0; i < columnNames.Length; i++)
{
selectsql.Append(columnNames[i] + " as " + columnTitles[i] + ",");
}
selectsql.Remove(selectsql.Length - 1, 1);
selectsql.Append(" from " + tableName);
return selectsql.ToString();
}
public string selectSql(string[] columnNames, string[] columnTitles, tableInfo[] tableinfos, string[] searchTypes, string[] status, bool isMulti)
{
StringBuilder selectsql = new StringBuilder("select ");
for (int i = 0; i < columnNames.Length; i++)
{
selectsql.Append(columnNames[i] + " as " + columnTitles[i] + ",");
}
selectsql.Remove(selectsql.Length - 1, 1);
selectsql.Append(" from "+tableName);
selectsql.Append(" "+wheresql.whereSql(tableinfos,searchTypes,status,isMulti));
return selectsql.ToString();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -