易截截图软件、单文件、免安装、纯绿色、仅160KB

C#连接Access和SQL Server数据库

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Str
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
/*
* connect to Sql Server
*/
string strConnection = "Data Source=ZRQ-PC;";
strConnection+="Initial Catalog=master;Integrated Security=True";
SqlConnection objConnection = new SqlConnection(strConnection);
objConnection.Open();
objConnection.Close();
/**************************************************************/
/*
* connect to access table
*/
//string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";
//strConnection += @"Data Source=C:\Users\ZRQ\Documents\STU.accdb";
//OleDbConnection objConnection = new OleDbConnection(strConnection);
//objConnection.Open();
//objConnection.Close();
/**************************************************************/
/*
*as for connect to Oracle or MySql 等我学了再说吧……(*^__^*)
*/
}
}
}
其中的简易办法:
在“服务器资源管理器”中选择要连接的数据,then看它的属性中Name,copy to strConnection 即可~


相关文档:

SQL里的主键和外键

这个逻辑关系乍看起来比较复杂,弄清楚了就好!
有两个表,
student(
id,
name,
primary key (id)
);
studentInfo(
id,
age,
address,
foreign key(id) references outTable(id) on delete cascade on update cascade
);
当我们删除student表的时候自然希望studentInfo里的相关信息也被删除,这就是外键起作用 ......

sql判断函数???

功能:小写金额转换成大写
参数:@LowerMoney 小写金额 加上小数点最长可以保留38位
输出:大写金额
简介:SQL版 小写金额转换成大写金额(最多可以精确到小数点四位)
注:      Decimal 数据类型最多可存储 38 个数字
转载:请保留以上信息,谢谢!!!
********************************* ......

sql执行顺序

标准的 sql 的解析顺序为: (1).from 子句  组装来自不同数据源的数据
 (2).where 子句  基于指定的条件对记录进行筛选
 (3).group by 子句  将数据划分为多个分组 
 (4).使用聚合函数进行计算
 (5).使用 having  ......

SQL Server 优化SELECT语句方法

 
本文转自:http://industry.ccidnet.com/art/1106/20070514/1080519_1.html
本文是SQL Server SQL语句优化系列文章的第一篇。该系列文章描述了在Micosoft’s SQLServer2000关系数据库管理系统中优化SELECT语句的基本技巧,我们讨论的技巧可在Microsoft's SQL Enterprise Manager或 Microsoft SQL Query Anal ......

magento 在Magento中获取SQL语句

       Magento是在Zend Framework的基础上搭建而来,有两种方式可以从Magento的collection获得真正的SQL语句。
以 Mage::getResourceModel('reports/product_collection') 为例:
1
         $collection=Mage::getResourceModel('reports/product_collection'); ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号