|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Troubles with .net data adapter v1.7
frameworks 1.1
studio 2003 my connect string: FbConnectionStringBuilder cs = new FbConnectionStringBuilder(); cs.DataSource = "localhost"; cs.Database = "b1.gdb"; cs.UserID = "SYSDBA"; cs.Password = "masterkey"; cs.Dialect = 3; cs.ConnectionLifeTime=0; cs.Charset="WIN1251"; cs.ConnectionTimeout=30; cs.PacketSize=8192; cs.ServerType=3; cs.Pooling=false; cs.FetchSize=20; cs.Port=3050; string connectionString = cs.ToString(); ---------------------------------------------------------- gives error:An invalid connection string argument has been supplied or a required connection string argument has not been supplied. ----------------------------------------------------------- code: string connectionString = "User=SYSDBA;" + "Password=masterkey;" + "Database=b1.gbd;" + "DataSource=localhost;" + "Port=3050;" + "Dialect=3;" + "Charset=WIN1251;" + "Role=;" + "Connection lifetime=15;" + "Pooling=true;" + "MinPoolSize=0;" + "MaxPoolSize=50;" + "Packet Size=8192;" + "ServerType=0"; ---------------------------------------------------------- Invalid PInvoke metadata format. what can I do? P.S. Можно и по-русски ![]() |
|
#2
|
|||
|
|||
|
Connection string for connecting to Firebird in .NET applications:
“User=SYSDBA;Password=masterkey; Database=SampleDatabase.fdb; DataSource=localhost; Port=3050;Dialect=3;Charset=NONE;Role=; Connection lifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=0″Database connection strings -- Best regards, Fikret Hasovic http://fikret.fbtalk.net FirebirdSQL Foundation member. - Join today at http://www.firebirdsql.org/ff/foundation JEDI VCS contributor http://jedivcs.sourceforge.net/ |
|
#3
|
|||
|
|||
|
Or try this piece of code:
using System; using System.Data; using FirebirdSql.Data.Firebird; public class Test { public static void Main(string[] args) { string connectionString = "Database=C:PROGRAM FILESFIREBIRDEXAMPLESEMPLOYEE.GDB;" + "User=SYSDBA;" + "Password=masterkey;" + "Dialect=3;" + "Server=localhost"; IDbConnection dbcon = new FbConnection(connectionString); dbcon.Open(); IDbCommand dbcmd = dbcon.CreateCommand(); string sql = "SELECT * FROM employee"; dbcmd.CommandText = sql; IDataReader reader = dbcmd.ExecuteReader(); while(reader.Read()) { object dataValue = reader.GetValue(0); string sValue = dataValue.ToString(); Console.WriteLine("Value: " + sValue); } // clean up reader.Close(); reader = null; dbcmd.Dispose(); dbcmd = null; dbcon.Close(); dbcon = null; } } -- Best regards, Fikret Hasovic http://fikret.fbtalk.net FirebirdSQL Foundation member. - Join today at http://www.firebirdsql.org/ff/foundation JEDI VCS contributor http://jedivcs.sourceforge.net/ |
|
#4
|
|||
|
|||
|
it didn't help...I don't know what to do...
it still writes: @Invalid PInvoke metadata format." |
|
#5
|
|||
|
|||
|
up
|
|
#6
|
|||
|
|||
|
here is my test code
using System;
using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using FirebirdSql.Data.Firebird; namespace WindowsApplication2 { /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.TreeView treeView1; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.RichTextBox richTextBox1; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.treeView1 = new System.Windows.Forms.TreeView(); this.textBox1 = new System.Windows.Forms.TextBox(); this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.SuspendLayout(); // // treeView1 // this.treeView1.ImageIndex = -1; this.treeView1.Location = new System.Drawing.Point(8, 0); this.treeView1.Name = "treeView1"; this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { new System.Windows.Forms.TreeNode("Node0", new System.Windows.Forms.TreeNode[] { new System.Windows.Forms.TreeNode("Node5", new System.Windows.Forms.TreeNode[] { new System.Windows.Forms.TreeNode("Node6", new System.Windows.Forms.TreeNode[] { new System.Windows.Forms.TreeNode("Node7")}), new System.Windows.Forms.TreeNode("Node12", new System.Windows.Forms.TreeNode[] { new System.Windows.Forms.TreeNode("Node13")})})}), new System.Windows.Forms.TreeNode("Node1", new System.Windows.Forms.TreeNode[] { new System.Windows.Forms.TreeNode("Node8", new System.Windows.Forms.TreeNode[] { new System.Windows.Forms.TreeNode("Node9", new System.Windows.Forms.TreeNode[] { new System.Windows.Forms.TreeNode("Node10", new System.Windows.Forms.TreeNode[] { new System.Windows.Forms.TreeNode("Node11")})})})}), new System.Windows.Forms.TreeNode("Node2"), new System.Windows.Forms.TreeNode("Node3"), new System.Windows.Forms.TreeNode("Node4")}); this.treeView1.SelectedImageIndex = -1; this.treeView1.Size = new System.Drawing.Size(64, 264); this.treeView1.TabIndex = 0; this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(168, 8); this.textBox1.Name = "textBox1"; this.textBox1.TabIndex = 1; this.textBox1.Text = "textBox1"; // // richTextBox1 // this.richTextBox1.Location = new System.Drawing.Point(72, 40); this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.Size = new System.Drawing.Size(216, 224); this.richTextBox1.TabIndex = 2; this.richTextBox1.Text = "richTextBox1"; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(292, 266); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.richTextBox1, this.textBox1, this.treeView1}); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); } #endregion /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) { this.textBox1.Text=this.treeView1.SelectedNode.Index.ToString(); } private void Form1_Load(object sender, System.EventArgs e) { // string connectionString = "Database=D:\\FireBird\\X.GBD;" + "User=SYSDBA;" + "Password=masterkey;Pooling=false;" + "Dialect=3;" + "Server=localhost"; try { using (FbConnection dbcon = new FbConnection(connectionString)) { dbcon.Open(); dbcon.Close(); richTextBox1.Text="FB"; } } catch (Exception e2) { string stack = e2.StackTrace.ToString(); richTextBox1.Text=stack; } // //richTextBox1.Text=System.Net.OSSOCK.gethostbyname("localhost").ToString(); } } } |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Troubles with .net data adapter v1.7 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|