<pre class="brush:c#;toolbar:false"> private void excOut(string filePath)
{
DataTable table = SqliteHelpers.ExecuteDataset(this.resZERO()).Tables[0];
if (table == null)
MessageBox.Show("请先进行盘点。");
else if (table.Rows.Count == 0)
MessageBox.Show("请先进行盘点。");
else
{
StreamWriter writer = new StreamWriter(filePath, false, Encoding.GetEncoding("gb2312"));
string fG = ",";
if (Program.FG == "t")
fG = "\t";
else
fG = Program.FG;
for (int i = 0; i < table.Rows.Count; i++)
{
string str3 = "";
for (int j = 0; j < table.Columns.Count; j++)
{
if (j > 0) str3 = str3 + fG;
str3 = str3 + table.Rows[i][j].ToString();
}
writer.WriteLine(str3);
}
writer.Close();
MessageBox.Show("导出成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
}
}
private void excOut(string sql, string filePath)
{
DataTable table = SqliteHelpers.ExecuteDataset(sql).Tables[0];
if (table == null)
MessageBox.Show("请先进行盘点。");
else if (table.Rows.Count == 0)
MessageBox.Show("请先进行盘点。");
else
{
string fG = ",";
if (Program.FG == "t")
fG = "\t";
else
fG = Program.FG;
StreamWriter writer = new StreamWriter(filePath, false, Encoding.GetEncoding("gb2312"));
for (int i = 0; i < table.Rows.Count; i++)
{
string str2 = "";
for (int j = 0; j < table.Columns.Count; j++)
{
if (j > 0) str2 = str2 + fG;
str2 = str2 + table.Rows[i][j].ToString();
}
writer.WriteLine(str2);
}
writer.Close();
MessageBox.Show("导出成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
}
}
private string resZERO()
{
string str = "select ";
string str2 = " group by ";
if (Program.BH == "Y")
{
str = str + "Point";
str2 = str2 + "Point";
}
if (Program.HH == "Y")
{
if (Program.BH == "Y")
{
str = str + ",SubPoint";
str2 = str2 + ",SubPoint";
}
else
{
str = str + "SubPoint";
str2 = str2 + "SubPoint";
}
}
if (Program.TM == "Y")
{
if (Program.BH == "Y" || Program.HH == "Y")
{
str = str + ",proCode";
str2 = str2 + ",proCode";
}
else
{
str = str + "proCode";
str2 = str2 + "proCode";
}
}
if (Program.SL == "Y")
{
if (Program.BH == "Y" || Program.HH == "Y" || Program.TM == "Y")
str = str + ",Sum(counts) counts";
else
str = str + "Sum(counts) counts";
}
return (str + " from bs_scan " + str2 + " Order by scanTime");
}</pre><pre class="brush:delphi;toolbar:false">get_py 函数 get_wb
//根据输入的字符串返回拼音码
string str_temp
string str_out
int i
str_out=''
for i=1 to len(str_in)
//返回字符串函数修改 gf_mid 修改为 mid 2019-5-13
str_temp=mid(str_in,i,1)
if str_temp<>' ' then
select n into : str_temp from twzk where z= : str_temp ;
str_out=str_out+upper(str_temp)
end if
if len(str_out)>8 then return str_out
next
return str_out</pre><p><br/></p>