Tags: cand, conection, database, mysql, oracle, orpoint, pervasive, pervasivesql, sql, tutrials

Pervasive.SQL and c#

On Database » Pervasive.SQL

2,546 words with 3 Comments; publish: Wed, 12 Dec 2007 10:36:00 GMT; (25046.88, « »)

Hi :)

How can i start a conection between c#

and Pervasive.SQL database ?

Can you show me how its done, or

point me to tutrials ?

Thanks :)

All Comments

Leave a comment...

  • 3 Comments
    • As I posted in another forum:

      A few questions and then a sample:

      1. What version of PSQL are you using?

      2. Do you have DDFs for your data?

      The sample below uses ODBC to connect to a PSQL database. There may be other options depending on the version you are using.

      Now the sample:

      using System;

      using System.Data;

      using System.Data.Odbc;

      using System.IO;

      namespace SimpleADONetTest

      {

      class Class1

      {

      [STAThread]

      static void Main(string[] args)

      {

      try

      {

      OdbcConnection conn=new OdbcConnection("DSN=DEMODATA");

      conn.Open();

      Console.WriteLine("ServerName: " + conn.ServerName.ToString());

      Console.WriteLine("ServerDSN: " + conn.ServerDSN.ToString());

      // Create a SQL command

      string strSQL = "select * from class";

      OdbcCommand DBCmd = new OdbcCommand(strSQL, conn);

      OdbcDataReader myDataReader;

      myDataReader = DBCmd.ExecuteReader();

      Console.WriteLine("FieldCount: " + myDataReader.FieldCount.ToString());

      while (myDataReader.Read())

      {

      for (int i=0;i

      {

      Console.WriteLine("Field " + i.ToString() + ": " + myDataReader[i].ToString());

      }

      }

      myDataReader.Close();

      conn.Close();

      Console.WriteLine("Press Enter to continue");

      Console.ReadLine();

      }

      catch (Exception ex)

      {

      Console.WriteLine(ex.Message);

      Console.ReadLine();

      }

      }

      }

      }

      #1; Tue, 11 Dec 2007 21:52:00 GMT
    • Thanks for bought of them :)

      Here is my answer in the second forum :)

      Thanks for your help.

      1) version 8

      2) yes, i have a database.

      I allready succeded on doing that,

      but i have a problem:

      Im doing it like that, and

      i cant put the information into

      a DataGrid, and i dont know why.

      string CoString = .pervasive.todaysummary.com."Provider=PervasiveOLEDB;" + .pervasive.todaysummary.com."Data Source=Z:\server;";

      string strSql = "SELECT * FROM TableTest2";

      OleDbConnection con = new OleDbConnection(CoString);

      con.Open();

      OleDbDataAdapter dadapter = new OleDbDataAdapter();

      dadapter.SelectCommand = new OleDbCommand(strSql, con);

      DataSet dset = new DataSet();

      dadapter.Fill(dset, "TableTest2");

      con.Close();

      this.dataGridView1.DataSource=dset;

      But, its not putting the data inside

      the dataGrid, why ?

      Thanks.

      #2; Tue, 11 Dec 2007 21:53:00 GMT
    • See my post in the other forum.
      #3; Tue, 11 Dec 2007 21:54:00 GMT