using MySql.Data.MySqlClient;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Linq;
namespace BaseLibDataProcess
{
public class SQLFunction
{
///
/// 获取指定表的指定字段的指定值的插入语句
///
/// 表
/// 字段
/// 值
/// 字符串值
public static string getInsertString(string Function, string Table, string[] arrField, string[] arrValue)
{
string strSQL = string.Empty;
if (arrField.Length != arrValue.Length)
{
throw new OraDBBaseException("字段的个数和值的个数不一致");
}
string str1 = "", str2 = "";
strSQL = Function + " into " + Table + "(";
for (int i = 0; i < arrField.Length; i++)
{
str1 += string.Format("{0},", arrField[i]);
str2 += string.Format("'{0}',", arrValue[i]);
}
strSQL += str1.Substring(0, str1.Length - 1) + ") values (";
strSQL += str2.Substring(0, str2.Length - 1) + ")";
return strSQL;
}
public enum SQLname
{
insert,
update,
delete
}
}
}