You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
2.5 KiB
C#
64 lines
2.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data.OleDb;
|
|
using System.Data;
|
|
|
|
namespace demo
|
|
{
|
|
class OperLocalAccess
|
|
{
|
|
public static string connectionString_PostIn = "Provider=Microsoft.ACE.OLEDB.12.0;" +
|
|
"Data Source=" + GlobalVariable.accessPostInPath + ";";
|
|
public static string tableName_PostIn = GlobalVariable.tableName_PostIn;
|
|
|
|
public static bool SelectInfoFromSFZ(string sfzid,ref PostInfo postInfo)
|
|
{
|
|
bool ret = false;
|
|
//string id, oddNum, applicantName, recvName, recvNo, recvAddress;
|
|
DataSet ds = new DataSet();
|
|
using (OleDbConnection conn = new OleDbConnection(connectionString_PostIn))
|
|
{
|
|
string sql = string.Format("select 收件人联系方式 from {0} where 收件人身份证号码 = '{1}'", tableName_PostIn, sfzid);
|
|
using (OleDbCommand cmd = new OleDbCommand(sql, conn))
|
|
{
|
|
try
|
|
{
|
|
conn.Open();
|
|
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
|
|
da.Fill(ds);
|
|
if (ds.Tables[0].Rows.Count == 1)
|
|
{
|
|
postInfo.id = ds.Tables[0].Rows[0]["yf_id"].ToString();
|
|
postInfo.recvAddress = ds.Tables[0].Rows[0]["yf_address"].ToString();
|
|
postInfo.postNo = ds.Tables[0].Rows[0]["yf_OddNumbers"].ToString();
|
|
postInfo.recvName = ds.Tables[0].Rows[0]["yf_receiver_name"].ToString();
|
|
postInfo.recvNo = ds.Tables[0].Rows[0]["yf_phone_number"].ToString();
|
|
postInfo.applicantName = ds.Tables[0].Rows[0]["yf_applicant_name"].ToString();
|
|
//postInfo = new string[] { id, oddNum, applicantName, recvName, recvNo, recvAddress };
|
|
ret = true;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
finally
|
|
{
|
|
try
|
|
{
|
|
cmd.Dispose();
|
|
conn.Close();
|
|
}
|
|
catch
|
|
{
|
|
ret = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
}
|
|
}
|