09-数据库操作/通用数据库连接/DatabaseCon/Form1.cs
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.IO;
namespace DatabaseCon
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public static string strCon = "";
private void Form1_Load(object sender, EventArgs e)
{
textBox6.Text = "(local)";
}
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "*.mdb(Access数据库文件)|*.mdb|*.xls(Excel文件)|*.xls|*.*(所有文件)|*.*";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
textBox1.Text = openFileDialog1.FileName;
}
}
private void button2_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.ShowDialog();
textBox6.Text = Form2.strServer;
}
private void button3_Click(object sender, EventArgs e)
{
if (radioButton1.Checked == true)
{
if (textBox1.Text != "")
{
FileInfo FInfo = new FileInfo(textBox1.Text);
string strExtention = FInfo.Extension;
if (strExtention.ToLower() == ".mdb")
{
if (textBox2.Text != "")
{
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + textBox1.Text + ";UID=" + textBox2.Text + ";PWD=" + textBox3.Text + ";";
}
else
{
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + textBox1.Text + ";";
}
后面还有 122 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
