C#读取access表,并把数据显示在gridcontrol中
//读取标准列表
private void setModelList()
{
OleDbConnection Connection = null;
string tableName = "";
try
{
string strMdb = this.textBox5.Text;//mdb路径
Connection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strMdb + "");
Connection.Open();
DataTable schemaTable = Connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
foreach (DataRow dr in schemaTable.Rows)
{
//表名
tableName = dr["TABLE_NAME"].ToString();
//字段名
//DataTable columnTable = Connection.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new object[]
相关文档:
//向数据库中写入
private void button1_Click(object sender, EventArgs e)
{
oracleConnection1.Open();
& ......
1. 打开新的窗口并传送参数:
传送参数:
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>")
接收参数:
string a = Request.QueryString("id");
string b = Request.QueryS ......
'创建数据库
Private Sub Create(ByVal mdbPath As String)
If File.Exists(mdbPath) Then
Throw New Exception("目标数据库已经存在,无法创建")
......
C# SQL数据库操作通用类
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
namespace Framework.DataBase
{
///
/// 通用数据库类
///
public class DataBase
{
private string ConnStr = null;
public DataBase()
{
&nb ......
注意:
在使用FindControl时,一定要在最贴近查找对象的外边加上个容器,如果你直接用this.FindControl,或Page.FindControl那么就会经常出现未将对象设置到实例
的错误,所以最好加一个容器,那么这里加的DIV就是一个容器,为了让FindControl在ID为"TextBoxs"的DIV内去找名为com1,com2,com3的TextBOx;
<div ......