大家连接数据库的时候是手动输入代码手动连接
还是用V studio里的连接,让他自动添加代码?
不过他自动连接时,我好象找不到他的连接代码在哪?
就好象连接MS SQL SERVER时,这句代码我就没在他里边找到过类似的
SqlConnection obc1=new SqlConnection("User ID=sa;Initial Catalog=wori;Data Source=127.0.0.1");
是这里吗?好象没有啊,还是我连接的方法不对?
mespace WindowsApplication1
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.woriDataSet = new WindowsApplication1.woriDataSet();
this.table1BindingSource = new System.Windows.Forms.BindingSource(this.components);
this.table1TableAdapter = new WindowsApplication1.woriDataSetTableAdapters.Table1TableAdapter();
this.textBox1 = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.woriDataSet)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.table1BindingSource)).BeginInit();
this.SuspendLayout();
//
// woriDataSet
//
this.woriDataSet.DataSetName = "woriDataSet";
this.woriDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
// table1BindingSource
//
this.table1BindingSource.DataMember = "Table1";
this.table1BindingSource.DataSource = this.woriDataSet;
//
// table1TableAdapter
//
this.table1TableAdapter.ClearBeforeFill = true;
//
// textBox1
//
this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.woriDataSet, "Table1.name", true));
this.textBox1.Location = new System.Drawing.Point(12, 12);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 21);
this.textBox1.TabIndex = 0;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 272);
this.Controls.Add(this.textBox1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.woriDataSet)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.table1BindingSource)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private woriDataSet woriDataSet;
private System.Windows.Forms.BindingSource table1BindingSource;
private WindowsApplication1.woriDataSetTableAdapters.Table1TableAdapter table1TableAdapter;
private System.Windows.Forms.TextBox textBox1;
}
}