Extracting data from pervasive sql 7 Dot net application or sql server 2005

  • I have software installed on machines which uses pervasive sql7 as database. I need to extract data from the pervasive sql 7. I have tried making a vb.net exe connecting through odbc but got no success.i have one server and client for pervasive sql 7 on two machines. here is my code

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using System.Data;

    using System.Data.Odbc;

    using System.Data.Sql;

    namespace ConsoleApplication1

    {

    class Program

    {

    static void Main(string[] args)

    {

    Console.Write("Dyelot=");

    string theDyelot = Console.ReadLine();

    using (OdbcConnection myConn = new OdbcConnection("dsn=PSQLV10DB-32"))

    {

    myConn.Open();

    OdbcCommand cmd = new OdbcCommand("SELECT Dyelot, ReDye, Machine, State FROM Dyelots" +

    " WHERE Dyelot = ? ORDER BY ReDye DESC", myConn);

    cmd.Parameters.AddWithValue("@Dyelot", theDyelot);

    OdbcCommand cmd2 = new OdbcCommand("SELECT Redye,CorrectionNumber,CallOff,Counter,ProductName,Amount,ActualAmount,Unit FROM Dyelot_Recipe" +

    " WHERE Dyelot = ? ORDER BY Redye,CorrectionNumber,CallOff,Counter DESC", myConn);

    cmd2.Parameters.Add("@Dyelot", OdbcType.VarChar);

    OdbcDataReader reader = cmd.ExecuteReader();

    while (reader.Read())

    {

    Console.WriteLine("Dyelot: {0,-20} Redye: {1,-5}, Machine: {2}", reader[0], reader[1], reader[2]);

    cmd2.Parameters[0].Value = theDyelot;

    OdbcDataReader reader2 = cmd2.ExecuteReader();

    while (reader2.Read())

    {

    Console.WriteLine(" {0}.{1}.{2}.{3} {4,-20},{5,-8}{6,-8}{7}", reader2[0], reader2[1], reader2[2], reader2[3], reader2[4], reader2[5], reader2[6], reader2[7]);

    }

    reader2.Close();

    }

    reader.Close();

    }

    Console.ReadKey();

    }

    }

    }

    but when i put my exe on client pc the exe doesn't run.

    Can anyone suggest where i am going wrong...how can i test my code on my local machine by making a pervasive odbc dsn on my own locall machine or any other way..

    My pervasive sql version is 7..any help is greatly appreciated...

  • It is difficult to help/replicate help us help you..what errors do you get...did you debugged the application you made???

    Raunak J

  • the.hank (10/11/2010)


    " WHERE Dyelot = ? ORDER BY ReDye DESC", myConn);

    cmd.Parameters.AddWithValue("@Dyelot", theDyelot);

    Replace the "?" with "@Dyelot"

    Raunak J

  • i can not debug on the machine ..i had made a exe and which didn't run and didn't show any error...pervasive sql 7 server and client are installed on two separate machines only ..i have to make application accordingly to extract data. NO other software is installed on those machines.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply