日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

PDA端的数据库一般采用的是sqlce数据库

發(fā)布時間:2023/11/30 数据库 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 PDA端的数据库一般采用的是sqlce数据库 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

PDA端的數(shù)據(jù)庫一般采用的是sqlce數(shù)據(jù)庫,這樣與PC端的sql2000中的數(shù)據(jù)同步就變成了一個問題,如在PDA端處理,PDA端的內(nèi)存,CPU等都是一個制約因素,其次他們的一個連接穩(wěn)定及其間的數(shù)據(jù)傳輸也是一個難點.本例中通過在PC端的轉(zhuǎn)化后再復(fù)制到PDA上面,這樣,上面所有的問題都得到了一個有效的控制.

一,創(chuàng)建項目,添加引用?

二 設(shè)計界面,編寫代碼

程序代碼

?

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?System.Data.SqlServerCe;
using?OpenNETCF.Desktop.Communication;
using?System.IO;
using?System.Collections;

namespace?FyfjmFileChange
{
????
public?partial?class?MainForm?:?Form
????
{
????????
string?_strCurrentDirectory?=?System.IO.Directory.GetCurrentDirectory();
????????RAPI?m_rapi?
=?new?RAPI();
????????
private?ArrayList?_arrData?=?new?ArrayList();
????????
private?string[]?Temp;
????????
private?int?sign;

????????
public?MainForm()
????????
{
????????????InitializeComponent();
????????}


????????
private?void?btOpenFile_Click(object?sender,?EventArgs?e)
????????
{
????????????
if?(openFileDialog.ShowDialog()?==?DialogResult.OK)
????????????
{
????????????????tbSourceLoadFile.Text?
=?openFileDialog.FileName;
????????????}

????????}


????????
private?void?btSaveFile_Click(object?sender,?EventArgs?e)
????????
{
????????????
if?(saveFileDialog.ShowDialog()?==?DialogResult.OK)
????????????
{
????????????????tbLoadPurposeFile.Text?
=?saveFileDialog.FileName;
????????????}

????????}


????????
private?void?btUp1Load_Click(object?sender,?EventArgs?e)
????????
{
????????????sign?
=?1;
????????????lbDownLoadState.Text?
=?"Status:Ready?Up……";

????????????Cursor.Current?
=?Cursors.WaitCursor;

????????????DataAcess.DisConnection();

????????????
if?(tbLoadPurposeFile.Text.Trim().Length?>?0?&&?tbPdaSourceFile.Text.Trim().Length?>?0)
????????????
{
????????????????
try
????????????????
{
????????????????????lbDownLoadState.Text?
=?"Status:Copying?the?File……";

????????????????????m_rapi.Connect(
false,?-1);
????????????????????m_rapi.CopyFileFromDevice(_strCurrentDirectory?
+?@"DataBaseFyfjm.sdf",?tbPdaSourceFile.Text.Trim()?+?@"DataBaseFyfjm.sdf",?true);
????????????????????m_rapi.Disconnect();

????????????????????lbDownLoadState.Text?
=?"Status:Changing?the?File……";

????????????????????
if?(FileFormCeDataBase(tbLoadPurposeFile.Text.Trim()))
????????????????????
{
????????????????????????MessageBox.Show(
"File?Update?successful",?"System?Message");

????????????????????????lbDownLoadState.Text?
=?"Status:Successful……";
????????????????????}

????????????????????
else
????????????????????
{
????????????????????????MessageBox.Show(
"DataFile?Change?Failed",?"System?Message");

????????????????????????lbDownLoadState.Text?
=?"Status:Failed……";
????????????????????}

????????????????}

????????????????
catch?(RAPIException?ex)
????????????????
{
????????????????????System.Windows.Forms.MessageBox.Show(ex.Message,?
"System?Message");

????????????????????lbDownLoadState.Text?
=?"Status:Failed……";
????????????????}

????????????}


????????????Cursor.Current?
=?Cursors.Default;
????????}


????????
private?void?btDownLoadStop_Click(object?sender,?EventArgs?e)
????????
{
????????????Close();
????????}


????????
private?void?btDownLoad_Click(object?sender,?EventArgs?e)
????????
{
????????????Cursor.Current?
=?Cursors.WaitCursor;

????????????
if?(tbSourceLoadFile.Text.Trim().Length?>?0?&&?tbPdaPurposeFile.Text.Trim().Length?>?0)
????????????
{
????????????????
if?(MessageBox.Show("Are?you?Sure?to?clear?the?SKU?data",?"System?Message",?MessageBoxButtons.OKCancel,?MessageBoxIcon.Question,?MessageBoxDefaultButton.Button2)?==?DialogResult.OK)
????????????????
{
????????????????????
try
????????????????????
{
????????????????????????SqlCeConnection?_objConn?
=?DataAcess.CreateConnection(_strCurrentDirectory?+?@"DataBaseFyfjm.sdf");
????????????????????????
string?_strSQL?=?"delete?from?Enquiry";

????????????????????????SqlCeCommand?_objComm?
=?_objConn.CreateCommand();
????????????????????????_objComm.CommandText?
=?_strSQL;
????????????????????????_objComm.CommandType?
=?CommandType.Text;
????????????????????????_objComm.ExecuteNonQuery();
????????????????????}

????????????????????
catch?(SqlCeException?ex)
????????????????????
{
????????????????????????MessageBox.Show(
"Delete?data?Failed "?+?ex.Message,?"System?Message",?MessageBoxButtons.OK,?MessageBoxIcon.Exclamation,?MessageBoxDefaultButton.Button1);
????????????????????????
return;
????????????????????}

????????????????}


????????????????
if?(File.Exists(tbSourceLoadFile.Text.Trim())?&&?FileToCeDataBase(tbSourceLoadFile.Text.Trim()))
????????????????
{
????????????????????
try
????????????????????
{
????????????????????????DataAcess.Dispose();???????????
//在復(fù)制之前要關(guān)閉數(shù)據(jù)庫
????????????????????????
//????????????????????????while?(DataAcess._objConn.State?==?ConnectionState.Closed)
????????????????????????
//????????????????????????{
????????????????????????m_rapi.Connect(false,?-1);
????????????????????????m_rapi.CopyFileToDevice(_strCurrentDirectory?
+?@"DataBaseFyfjm.sdf",?tbPdaPurposeFile.Text.Trim()?+?@"DataBaseFyfjm.sdf",?true);
????????????????????????m_rapi.Disconnect();
????????????????????????MessageBox.Show(
"Down?File?to?device?successful",?"System?Message");
????????????????????????
//????????????????????????}
????????????????????}

????????????????????
catch?(RAPIException?ex)
????????????????????
{
????????????????????????System.Windows.Forms.MessageBox.Show(ex.Message,?
"System?Message");
????????????????????}

????????????????????
//}
????????????????}

????????????????
else
????????????????
{
????????????????????MessageBox.Show(
"The?SourceFile?not?exist",?"System?Message",?MessageBoxButtons.OK,?MessageBoxIcon.Asterisk);
????????????????}


????????????????Cursor.Current?
=?Cursors.Default;
????????????????DownLoadProgressBar.Value?
=?0;
????????????}

????????}


????????
private?void?UpStop_Click(object?sender,?EventArgs?e)
????????
{
????????????Close();
????????}


????????
private?bool?SaveTxt(string?strFilePath)
????????
{
????????????
bool?_bResult?=?false;
????????????DataSet?_objDs?
=?new?DataSet();
????????????
try
????????????
{
????????????????SqlCeConnection?_objConn?
=?DataAcess.CreateConnection(_strCurrentDirectory?+?@"DataBaseFyfjm.sdf");
????????????????SqlCeCommand?_objComm?
=?_objConn.CreateCommand();
????????????????_objComm.CommandText?
=?"SELECT?SKU?FROM?Take?where?Take_sign?=??'0'";
????????????????_objComm.CommandType?
=?CommandType.Text;
????????????????SqlCeDataAdapter?_objDa?
=?new?SqlCeDataAdapter(_objComm);
????????????????SqlCeCommandBuilder?_objCb?
=?new?SqlCeCommandBuilder(_objDa);
????????????????_objDa.Fill(_objDs);

????????????????UpLoadProgressBar.Maximum?
=?_objDs.Tables[0].Rows.Count;
????????????????UpLoadProgressBar.Step?
=?0;

????????????????System.IO.StreamWriter?_objWriter?
=?new?StreamWriter(strFilePath,?false,?System.Text.Encoding.UTF8);

????????????????
int?i?=?0;
????????????????
foreach?(DataRow?_objDr?in?_objDs.Tables[0].Rows)
????????????????
{
????????????????????
string?_sLine?=?_objDr[0]?+?","?+?"1";
????????????????????_objWriter.WriteLine(_sLine);

????????????????????i
++;
????????????????????UpLoadProgressBar.Value?
=?i;
????????????????}

????????????????_objWriter.Close();

????????????????DataAcess.Close();
????????????????_objConn.Close();
????????????????_objConn.Dispose();
????????????????_objConn?
=?null;
????????????????_objComm.Dispose();
????????????????_bResult?
=?true;
????????????????
????????????}

????????????
catch?(SqlCeException?ex)
????????????
{
????????????????MessageBox.Show(ex.Message,?
"系統(tǒng)提示:",?MessageBoxButtons.OK,?MessageBoxIcon.Asterisk,?MessageBoxDefaultButton.Button1);
????????????}

????????????
catch?(Exception?ex1)
????????????
{
????????????????MessageBox.Show(ex1.Message,?
"系統(tǒng)提示:",?MessageBoxButtons.OK,?MessageBoxIcon.Asterisk,?MessageBoxDefaultButton.Button1);
????????????}


????????????
return?_bResult;
????????}


????????
private?bool?FileFormCeDataBase(string?strFilePath)
????????
{
????????????
bool?_bResult?=?false;
????????????
string[]?_strTemp?=?strFilePath.Split('.');
????????????
string?_strFileStype?=?_strTemp[_strTemp.Length?-?1];
????????????
switch?(_strFileStype.ToUpper())
????????????
{
????????????????
/*case?"XLS":
????????????????????_bResult?=?SaveXLS(strFilePath);
????????????????????break;
????????????????case?"CSV":
????????????????????_bResult?=?SaveCSV(strFilePath);
????????????????????break;
*/

????????????????
case?"TXT":
????????????????????
switch?(sign)
????????????????????
{
????????????????????????
case?1:
????????????????????????????_bResult?
=?SaveTxt(strFilePath);
????????????????????????????
break;
????????????????????????
case?2:
????????????????????????????_bResult?
=?SumSaveTxt(strFilePath);
????????????????????????????
break;
????????????????????????
case?3:
????????????????????????????_bResult?
=?AllSaveTxt(strFilePath);
????????????????????????????
break;
????????????????????????
default:
????????????????????????????
break;
????????????????????}

????????????????????
break;
????????????????
default:
????????????????????
{
????????????????????????MessageBox.Show(
"File?Format?Error",?"System?Message",?MessageBoxButtons.OK,?MessageBoxIcon.Asterisk);
????????????????????????
break;
????????????????????}

????????????}


????????????UpLoadProgressBar.Value?
=?0;

????????????
return?_bResult;
????????}


????????
private?bool?FileToCeDataBase(string?strFilePath)
????????
{
????????????
bool?_bResult?=?false;
????????????
try
????????????
{
????????????????_arrData?
=?new?ArrayList();
????????????????System.IO.StreamReader?objectReader?
=?new?System.IO.StreamReader(strFilePath,?System.Text.Encoding.UTF8);
????????????????
string?sLine?=?"";

????????????????
while?(sLine?!=?null)
????????????????
{
????????????????????sLine?
=?objectReader.ReadLine();
????????????????????
if?(sLine?!=?null)
????????????????????
{
????????????????????????_arrData.Add(sLine);
????????????????????}

????????????????}

????????????????objectReader.Close();
????????????}

????????????
catch?(Exception?ex)
????????????
{
????????????????MessageBox.Show(ex.Message,?
"系統(tǒng)提示",?MessageBoxButtons.OK,?MessageBoxIcon.Asterisk,?MessageBoxDefaultButton.Button1);
????????????}


????????????SqlCeConnection?_objConn?
=?DataAcess.CreateConnection(_strCurrentDirectory?+?@"DataBaseFyfjm.sdf");
????????????SqlCeCommand?_objComm?
=?_objConn.CreateCommand();

????????????DownLoadProgressBar.Maximum?
=?_arrData.Count;
????????????DownLoadProgressBar.Step?
=?1;

????????????
for?(int?j?=?0;?j?<?_arrData.Count;?j++)
????????????
{
????????????????Temp?
=?_arrData[j].ToString().Trim().Split(',');
????????????????_objComm.CommandText?
=?string.Format("insert?into?Enquiry(Code,Color,Size,Price,SKU)?values('{0}','{1}','{2}','{3}','{4}')",?Temp[0].Trim(),?Temp[1].Trim(),?Temp[2].Trim(),?Temp[3].Trim(),?Temp[4].Trim());
????????????????_objComm.ExecuteNonQuery();

????????????????DownLoadProgressBar.Value
++;
????????????}

????????????_arrData.Clear();
????????????_bResult?
=?true;

????????????_objConn.Close();
????????????_objConn.Dispose();
????????????_objConn?
=?null;
????????????_objComm.Dispose();
????????????
return?_bResult;
????????????
????????}


????????
private?void?btUp2Load_Click(object?sender,?EventArgs?e)
????????
{
????????????sign?
=?2;
????????????lbDownLoadState.Text?
=?"Status:Ready?Up……";

????????????Cursor.Current?
=?Cursors.WaitCursor;

????????????DataAcess.DisConnection();

????????????
if?(tbLoadPurposeFile.Text.Trim().Length?>?0?&&?tbPdaSourceFile.Text.Trim().Length?>?0)
????????????
{
????????????????
try
????????????????
{
????????????????????lbDownLoadState.Text?
=?"Status:Copying?the?File……";

????????????????????m_rapi.Connect(
false,?-1);
????????????????????m_rapi.CopyFileFromDevice(_strCurrentDirectory?
+?@"DataBaseFyfjm.sdf",?tbPdaSourceFile.Text.Trim()?+?@"DataBaseFyfjm.sdf",?true);
????????????????????m_rapi.Disconnect();

????????????????????lbDownLoadState.Text?
=?"Status:Changing?the?File……";

????????????????????
if?(FileFormCeDataBase(tbLoadPurposeFile.Text.Trim()))
????????????????????
{
????????????????????????MessageBox.Show(
"File?Update?successful",?"System?Message");

????????????????????????lbDownLoadState.Text?
=?"Status:Successful……";
????????????????????}

????????????????????
else
????????????????????
{
????????????????????????MessageBox.Show(
"DataFile?Change?Failed",?"System?Message");

????????????????????????lbDownLoadState.Text?
=?"Status:Failed……";
????????????????????}

????????????????}

????????????????
catch?(RAPIException?ex)
????????????????
{
????????????????????System.Windows.Forms.MessageBox.Show(ex.Message,?
"System?Message");

????????????????????lbDownLoadState.Text?
=?"Status:Failed……";
????????????????}

????????????}


????????????Cursor.Current?
=?Cursors.Default;
????????}


????????
private?bool?SumSaveTxt(string?strFilePath)
????????
{
????????????
bool?_bResult?=?false;
????????????DataSet?_objDs?
=?new?DataSet();
????????????
try
????????????
{
????????????????SqlCeConnection?_objConn?
=?DataAcess.CreateConnection(_strCurrentDirectory?+?@"DataBaseFyfjm.sdf");
????????????????SqlCeCommand?_objComm?
=?_objConn.CreateCommand();
????????????????_objComm.CommandText?
=?"select?SKU,Count(*)as?Qty?from?Take?where?Take_sign?=?'0'?Group?By?SKU";
????????????????_objComm.CommandType?
=?CommandType.Text;
????????????????SqlCeDataAdapter?_objDa?
=?new?SqlCeDataAdapter(_objComm);
????????????????SqlCeCommandBuilder?_objCb?
=?new?SqlCeCommandBuilder(_objDa);
????????????????_objDa.Fill(_objDs);

????????????????UpLoadProgressBar.Maximum?
=?_objDs.Tables[0].Rows.Count;
????????????????UpLoadProgressBar.Step?
=?0;

????????????????System.IO.StreamWriter?_objWriter?
=?new?StreamWriter(strFilePath,?false,?System.Text.Encoding.UTF8);

????????????????
int?i?=?0;
????????????????
foreach?(DataRow?_objDr?in?_objDs.Tables[0].Rows)
????????????????
{
????????????????????
string?_sLine?=?_objDr[0]?+?","?+?_objDr[1];
????????????????????_objWriter.WriteLine(_sLine);

????????????????????i
++;
????????????????????UpLoadProgressBar.Value?
=?i;
????????????????}

????????????????_objWriter.Close();

????????????????DataAcess.Close();
????????????????_objConn.Close();
????????????????_objConn.Dispose();
????????????????_objConn?
=?null;
????????????????_objComm.Dispose();
????????????????_bResult?
=?true;

????????????}

????????????
catch?(SqlCeException?ex)
????????????
{
????????????????MessageBox.Show(ex.Message,?
"系統(tǒng)提示:",?MessageBoxButtons.OK,?MessageBoxIcon.Asterisk,?MessageBoxDefaultButton.Button1);
????????????}

????????????
catch?(Exception?ex1)
????????????
{
????????????????MessageBox.Show(ex1.Message,?
"系統(tǒng)提示:",?MessageBoxButtons.OK,?MessageBoxIcon.Asterisk,?MessageBoxDefaultButton.Button1);
????????????}


????????????
return?_bResult;
????????}


????????
private?void?btTake_Click(object?sender,?EventArgs?e)
????????
{
????????????Cursor.Current?
=?Cursors.WaitCursor;
????????????
if?(MessageBox.Show("Are?you?Sure?to?clear?the?Stock?Take?data",?"System?Message",?MessageBoxButtons.OKCancel,?MessageBoxIcon.Question,?MessageBoxDefaultButton.Button2)?==?DialogResult.OK)
????????????
{
????????????????
try
????????????????
{
????????????????????SqlCeConnection?_objConn?
=?DataAcess.CreateConnection(_strCurrentDirectory?+?@"DataBaseFyfjm.sdf");
????????????????????
string?_strSQL1?=?"delete?from?Take";

????????????????????SqlCeCommand?_objComm?
=?_objConn.CreateCommand();
????????????????????_objComm.CommandText?
=?_strSQL1;
????????????????????_objComm.CommandType?
=?CommandType.Text;
????????????????????_objComm.ExecuteNonQuery();

????????????????????DataAcess.Dispose();???????????
//在復(fù)制之前要關(guān)閉數(shù)據(jù)庫
????????????????????m_rapi.Connect(false,?-1);
????????????????????m_rapi.CopyFileToDevice(_strCurrentDirectory?
+?@"DataBaseFyfjm.sdf",?tbPdaPurposeFile.Text.Trim()?+?@"DataBaseFyfjm.sdf",?true);
????????????????????m_rapi.Disconnect();
????????????????????MessageBox.Show(
"Delete?Successful!",?"System?Message",?MessageBoxButtons.OK,?MessageBoxIcon.Information,?MessageBoxDefaultButton.Button1);
????????????????}

????????????????
catch?(SqlCeException?ex)
????????????????
{
????????????????????MessageBox.Show(
"Delete?data?Failed "?+?ex.Message,?"System?Message",?MessageBoxButtons.OK,?MessageBoxIcon.Exclamation,?MessageBoxDefaultButton.Button1);
????????????????????
return;
????????????????}

????????????}

????????????Cursor.Current?
=?Cursors.Default;
????????}


????????
private?void?btAllclear_Click(object?sender,?EventArgs?e)
????????
{
????????????
if?(MessageBox.Show("Are?you?Sure?to?clear?all?the?data",?"System?Message",?MessageBoxButtons.OKCancel,?MessageBoxIcon.Question,?MessageBoxDefaultButton.Button2)?==?DialogResult.OK)
????????????
{
????????????????
try
????????????????
{
????????????????????SqlCeConnection?_objConn?
=?DataAcess.CreateConnection(_strCurrentDirectory?+?@"DataBaseFyfjm.sdf");
????????????????????
string?_strSQL?=?"delete?from?Take";
????????????????????
string?_strSQL1?=?"delete?from?Enquiry";

????????????????????SqlCeCommand?_objComm?
=?_objConn.CreateCommand();
????????????????????_objComm.CommandText?
=?_strSQL;
????????????????????_objComm.CommandType?
=?CommandType.Text;
????????????????????_objComm.ExecuteNonQuery();

????????????????????_objComm.CommandText?
=?_strSQL1;
????????????????????_objComm.CommandType?
=?CommandType.Text;
????????????????????_objComm.ExecuteNonQuery();

????????????????????DataAcess.Dispose();???????????
//在復(fù)制之前要關(guān)閉數(shù)據(jù)庫
????????????????????m_rapi.Connect(false,?-1);
????????????????????m_rapi.CopyFileToDevice(_strCurrentDirectory?
+?@"DataBaseFyfjm.sdf",?tbPdaPurposeFile.Text.Trim()?+?@"DataBaseFyfjm.sdf",?true);
????????????????????m_rapi.Disconnect();

????????????????????MessageBox.Show(
"Delete?Successful!",?"System?Message",?MessageBoxButtons.OK,?MessageBoxIcon.Information,?MessageBoxDefaultButton.Button1);
????????????????}

????????????????
catch?(SqlCeException?ex)
????????????????
{
????????????????????MessageBox.Show(
"Delete?data?Failed "?+?ex.Message,?"System?Message",?MessageBoxButtons.OK,?MessageBoxIcon.Exclamation,?MessageBoxDefaultButton.Button1);
????????????????????
return;
????????????????}

????????????}

????????}


????????
private?void?btUp3Load_Click(object?sender,?EventArgs?e)
????????
{
????????????sign?
=?3;
????????????lbDownLoadState.Text?
=?"Status:Ready?Up……";

????????????Cursor.Current?
=?Cursors.WaitCursor;

????????????DataAcess.DisConnection();

????????????
if?(tbLoadPurposeFile.Text.Trim().Length?>?0?&&?tbPdaSourceFile.Text.Trim().Length?>?0)
????????????
{
????????????????
try
????????????????
{
????????????????????lbDownLoadState.Text?
=?"Status:Copying?the?File……";

????????????????????m_rapi.Connect(
false,?-1);
????????????????????m_rapi.CopyFileFromDevice(_strCurrentDirectory?
+?@"DataBaseFyfjm.sdf",?tbPdaSourceFile.Text.Trim()?+?@"DataBaseFyfjm.sdf",?true);
????????????????????m_rapi.Disconnect();

????????????????????lbDownLoadState.Text?
=?"Status:Changing?the?File……";

????????????????????
if?(FileFormCeDataBase(tbLoadPurposeFile.Text.Trim()))
????????????????????
{
????????????????????????MessageBox.Show(
"File?Update?successful",?"System?Message");

????????????????????????lbDownLoadState.Text?
=?"Status:Successful……";
????????????????????}

????????????????????
else
????????????????????
{
????????????????????????MessageBox.Show(
"DataFile?Change?Failed",?"System?Message");

????????????????????????lbDownLoadState.Text?
=?"Status:Failed……";
????????????????????}

????????????????}

????????????????
catch?(RAPIException?ex)
????????????????
{
????????????????????System.Windows.Forms.MessageBox.Show(ex.Message,?
"System?Message");

????????????????????lbDownLoadState.Text?
=?"Status:Failed……";
????????????????}

????????????}


????????????Cursor.Current?
=?Cursors.Default;
????????}


????????
private?bool?AllSaveTxt(string?strFilePath)
????????
{
????????????
bool?_bResult?=?false;
????????????DataSet?_objDs?
=?new?DataSet();
????????????
try
????????????
{
????????????????SqlCeConnection?_objConn?
=?DataAcess.CreateConnection(_strCurrentDirectory?+?@"DataBaseFyfjm.sdf");
????????????????SqlCeCommand?_objComm?
=?_objConn.CreateCommand();
????????????????_objComm.CommandText?
=?"select?SKU,Zone,Take_sign?from?Take";
????????????????_objComm.CommandType?
=?CommandType.Text;
????????????????SqlCeDataAdapter?_objDa?
=?new?SqlCeDataAdapter(_objComm);
????????????????SqlCeCommandBuilder?_objCb?
=?new?SqlCeCommandBuilder(_objDa);
????????????????_objDa.Fill(_objDs);

????????????????UpLoadProgressBar.Maximum?
=?_objDs.Tables[0].Rows.Count;
????????????????UpLoadProgressBar.Step?
=?0;

????????????????System.IO.StreamWriter?_objWriter?
=?new?StreamWriter(strFilePath,?false,?System.Text.Encoding.UTF8);

????????????????
int?i?=?0;
????????????????
foreach?(DataRow?_objDr?in?_objDs.Tables[0].Rows)
????????????????
{
????????????????????
string?_sLine?=?_objDr[1]?+?","?+?_objDr[0]?+?","?+?"1"?+?","?+?_objDr[2];
????????????????????_objWriter.WriteLine(_sLine);

????????????????????i
++;
????????????????????UpLoadProgressBar.Value?
=?i;
????????????????}

????????????????_objWriter.Close();

????????????????DataAcess.Close();
????????????????_objConn.Close();
????????????????_objConn.Dispose();
????????????????_objConn?
=?null;
????????????????_objComm.Dispose();
????????????????_bResult?
=?true;

????????????}

????????????
catch?(SqlCeException?ex)
????????????
{
????????????????MessageBox.Show(ex.Message,?
"系統(tǒng)提示:",?MessageBoxButtons.OK,?MessageBoxIcon.Asterisk,?MessageBoxDefaultButton.Button1);
????????????}

????????????
catch?(Exception?ex1)
????????????
{
????????????????MessageBox.Show(ex1.Message,?
"系統(tǒng)提示:",?MessageBoxButtons.OK,?MessageBoxIcon.Asterisk,?MessageBoxDefaultButton.Button1);
????????????}


????????????
return?_bResult;
????????}


????}

}

總結(jié)

以上是生活随笔為你收集整理的PDA端的数据库一般采用的是sqlce数据库的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。