• 微软原版系统

  • 一键重装系统

  • 纯净系统

  • 在线技术客服

魔法猪系统重装大师 一键在线制作启动 U 盘 PE 系统 用一键重装的魔法拯救失去灵魂的系统
当前位置:首页 > 教程 > 电脑教程

C#SQLiteWindowsMobile数据库手机技术开发

时间:2015年04月02日 15:46:02    来源:魔法猪系统重装大师官网    人气:15226

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.SqlClient;

using System.Data.SqlServerCe;

using System.Net;

using System.IO;

namespace WinAppGrid

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

//创建数据库的表

private Boolean CreateTable()

{

try

{

SqlCeConnection myconn = new SqlCeConnection("DataSource=mysdf.sdf");

SqlCeCommand com = new SqlCeCommand("create table PC (PCNO NVarChar(10) primary key,XH NVarChar(10) NOT NULL,WERKS NVarChar(4) NOT NULL,PC_DATE NVarChar(10))");

myconn.Open();

com.Connection = myconn;

com.ExecuteNonQuery();

myconn.Close();

MessageBox.Show("创建数据库成功!");

return true;

}

catch (Exception ex)

{

MessageBox.Show("创建数据库失败" + ex.ToString().Substring(1, 60));

return false;

}

 

 

 

}

private void button1_Click(object sender, EventArgs e)

{

//创建数据库

try

{

if ( File.Exists("mysdf.sdf"))

{

MessageBox.Show("数据库已经存在");

 

}

else

{

SqlCeEngine eng = new SqlCeEngine("DataSource=mysdf.sdf");

eng.CreateDatabase();

eng.Dispose();

MessageBox.Show("创建数据库成功");

 

  

}

Boolean rtu;

rtu = CreateTable();

if (rtu = false)

{

MessageBox.Show("数据表已经存在!");

}

else

{

MessageBox.Show("创建数据表成功!");

 

 

}

 

}

catch(Exception ex)

{

MessageBox.Show("创建数据库失败"+ ex.ToString().Substring(1,60));

 

}

 

}

}
 

C#SQLiteWindowsMobile,数据库,手机,技
栏目:电脑教程 阅读:1000 2023/12/27
Win7教程 更多>>
U盘教程 更多>>
Win10教程 更多>>
魔法猪学院 更多>>

Copyright © 2015-2023 魔法猪 魔法猪系统重装大师

本站发布的系统仅为个人学习测试使用,请在下载后24小时内删除,不得用于任何商业用途,否则后果自负,请支持购买微软正版软件。

在线客服 查看微信 返回顶部