Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 10 total
Thread ElevateDB .NET ConnectionString
Wed, Jan 9 2008 10:40 AMPermanent Link

Matej Kozinc
I was trying to create Connection  string to local database using ADO.NET (NOT ODBC!)
provider but have failed to make one (even with EDBConectionStringBuilder). Could any one
post a sample ConnectionString?

Thanks, MK
Wed, Jan 9 2008 12:13 PMPermanent Link

DavidS
           EDBConnectionStringBuilder connectionstringbuilder = new EDBConnectionStringBuilder();

            connectionstringbuilder.ConfigPath = @"C:\Tutorial";
           
           connectionstringbuilder.UID = "Administrator";
           connectionstringbuilder.PWD = "EDBDefault";
           connectionstringbuilder.Database = "Tutorial";

           EDBConnection connection = new EDBConnection(connectionstringbuilder.ConnectionString);

           connection.Open();

Good luck I have a problem reading a simple string form the database.

Regards,

David


Matej Kozinc <kozincm@volja.net> wrote:

I was trying to create Connection  string to local database using ADO.NET (NOT ODBC!)
provider but have failed to make one (even with EDBConectionStringBuilder). Could any one
post a sample ConnectionString?

Thanks, MK
Wed, Jan 9 2008 4:48 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

David,

<< Good luck I have a problem reading a simple string form the database. >>

Please don't post comments like that.  If you have an issue, please give us
an opportunity to help you resolve it first.  If we don't resolve the issue,
then you are free to post as many negative comments as you would like. Smiley

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Jan 10 2008 6:25 AMPermanent Link

DavidS
Sorry Tim, I guess I did not think that one through.

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:

David,

<< Good luck I have a problem reading a simple string form the database. >>

Please don't post comments like that.  If you have an issue, please give us
an opportunity to help you resolve it first.  If we don't resolve the issue,
then you are free to post as many negative comments as you would like. Smiley

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Jan 10 2008 7:03 AMPermanent Link

Matej Kozinc
I have tried EDBConnectionStringBuilder but got the following error:
"ElevateDB Error #100 There is an error in the metadata for the object EDBConfig
(Signature, password, character set (ANSI/Unicode), or version number mismatch)".

I found this issue described in two other threads:
1)
http://www.elevatesoft.com/scripts/newsgrp.dll?action=searchopenmsg&group=16&msg=2918&keywords=ElevateDB*%20Error*%20100*%20There*%20error*%20metadata*%20object*%20EDBConfig*#msg2918
2)
http://www.elevatesoft.com/scripts/newsgrp.dll?action=searchopenmsg&group=16&msg=2896&keywords=ElevateDB*%20Error*%20100*%20There*%20error*%20metadata*%20object*%20EDBConfig*#msg2896
but could not have solved my problem.

I used both default and my own password, didn't use Unicode Version at all and used the
default signature. It leaves version number (or I missed someting).

I used Odbc and it worked fine.
Thu, Jan 10 2008 6:05 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

David,

<< Sorry Tim, I guess I did not think that one through. >>

No problem.  I got your voice message and I'll be calling you in the morning
(EST -5 GMT) to discuss your issues.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Jan 10 2008 6:08 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matej,

<<I have tried EDBConnectionStringBuilder but got the following error:
"ElevateDB Error #100 There is an error in the metadata for the object
EDBConfig
(Signature, password, character set (ANSI/Unicode), or version number
mismatch)". >>

If you're accessing an existing configuration, then the configuration must
be a Unicode configuration with Unicode databases.  Remember, the native
..NET data provider is 100% Unicode all the time, whereas the ODBC driver can
be either.  This is another reason why we're thinking about abstracting out
the database engine layer into an unmanaged DLL for use with the .NET data
provider - to allow for the database engine to be used in ANSI or Unicode
mode, even with the .NET data provider.

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Jan 11 2008 5:37 AMPermanent Link

Matej Kozinc
Thank you Tim, this works. Now that I can connect to the database I can read from it
normally but I have a problem with writing into it.

This is the string that I used in ElevateDB Manager and inserted the row successfully:
INSERT INTO BS
(rtrr,iban,vrsta,banka,naziv,ulica,hs,naselje,posta,kraj,davcna,maticna,drzava,obcina,vrsta_subjekta,dejavnost,sektor,dtOdprt,dtSprememba,dtzaprt,eno,del_registra,isddv,dtOdprt_dt,dtSprememba_dt,dtZaprt_dt,dtCreated,dtUpdated)
VALUES (300000000123456,'SI56','T','Volksb.-Ljud.b.  ','DRUŠTVO LJUBITELJEV SONCA        
','BUABCDLAK','086','                                  
','3221','TEHARJE',47923903,1644858,'705','011 ','453','10.330','S.15   ','          ','
       ','15.10.2006',' ','P',False,NULL,NULL,TIMESTAMP '2006-10-15 0:0:0',TIMESTAMP
'2007-12-2 2:48:44',TIMESTAMP '2007-12-2 2:51:25')

I get the following error when using it in source code:
"ElevateDB Error #700 An error was found in the statement at line 1 and column 250
(Missing expression)"

Column 250 is at the '(' after 'VALUES '.
I am reading data from System.Data.DataTable.

The source:
foreach (DataRow row in dtSource.Rows)
           {
               string edbInsert = @"INSERT INTO BS
(rtrr,iban,vrsta,banka,naziv,ulica,hs,naselje,posta,kraj,davcna,maticna,drzava,obcina,vrsta_subjekta,dejavnost,sektor,dtOdprt,dtSprememba,dtzaprt,eno,del_registra,isddv,dtOdprt_dt,dtSprememba_dt,dtZaprt_dt,dtCreated,dtUpdated)
VALUES (";
               
               EDBCommand edbCom = new EDBCommand(edbInsert, connEdb);
               edbInsert += "" + Convert.ToDouble(row[0].ToString()) + ",";
               edbInsert += "'" + row[1].ToString() + "','" + row[2].ToString() + "','" +
row[3].ToString() + "','" + row[4].ToString() + "','" + row[5].ToString() + "','" +
row[6].ToString() + "','" + row[7].ToString() + "','" + row[8].ToString() + "','" +
row[9].ToString() + "',";
               int davcna = 0;
               bool ddv = Int32.TryParse(row[10].ToString(), out davcna);
               edbInsert += (ddv ? davcna.ToString() : "NULL") + ",";
               int maticna = 0;
               bool mat = Int32.TryParse(row[11].ToString(), out maticna);
               edbInsert += (mat ? maticna.ToString() : "NULL") + ",";
               edbInsert += "'" + row[12].ToString() + "','" + row[13].ToString() + "','"
+ row[14].ToString() + "','" + row[15].ToString() + "','" + row[16].ToString() + "','" +
row[17].ToString() + "','" + row[18].ToString() + "','" + row[19].ToString() + "','" +
row[20].ToString() + "','" + row[21].ToString() + "',";
               bool isDDV = false;
               bool isIt = Boolean.TryParse(row[22].ToString(), out isDDV);
               edbInsert += "" + (isIt ? (isDDV).ToString() : "NULL") + ",";
               DateTime dt = new DateTime(1900, 1, 1);
               bool date = false;
               date = DateTime.TryParse(row[23].ToString(), out dt);
               edbInsert += (date) ? ("TIMESTAMP '" + dt.Year + "-" + dt.Month + "-" +
dt.Day + " " + dt.Hour + ":" + dt.Minute + ":" + dt.Second + "',") : ("NULL,");
               dt = new DateTime(1900, 1, 1);
               date = false;
               date = DateTime.TryParse(row[24].ToString(), out dt);
               edbInsert += (date) ? ("TIMESTAMP '" + dt.Year + "-" + dt.Month + "-" +
dt.Day + " " + dt.Hour + ":" + dt.Minute + ":" + dt.Second + "',") : ("NULL,");
               dt = new DateTime(1900, 1, 1);
               date = false;
               date = DateTime.TryParse(row[25].ToString(), out dt);
               edbInsert += (date) ? ("TIMESTAMP '" + dt.Year + "-" + dt.Month + "-" +
dt.Day + " " + dt.Hour + ":" + dt.Minute + ":" + dt.Second + "',") : ("NULL,");
               dt = new DateTime(1900, 1, 1);
               date = false;
               date = DateTime.TryParse(row[26].ToString(), out dt);
               edbInsert += (date) ? ("TIMESTAMP '" + dt.Year + "-" + dt.Month + "-" +
dt.Day + " " + dt.Hour + ":" + dt.Minute + ":" + dt.Second + "',") : ("NULL,");
               dt = new DateTime(1900, 1, 1);
               date = false;
               date = DateTime.TryParse(row[27].ToString(), out dt);
               edbInsert += (date) ? ("TIMESTAMP '" + dt.Year + "-" + dt.Month + "-" +
dt.Day + " " + dt.Hour + ":" + dt.Minute + ":" + dt.Second + "'") : ("NULL");
               edbInsert += ")";
               connEdb.Open();
               edbCom.ExecuteNonQuery();
               connEdb.Clone();
           }

Fri, Jan 11 2008 9:54 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Hi,

Is there a space between ",dtUpdated)" and "VALUES(" ?
It is hard to tell as it has wrapped the line

Chris HOlland


Matej Kozinc wrote:
> Thank you Tim, this works. Now that I can connect to the database I can read from it
> normally but I have a problem with writing into it.
>
> This is the string that I used in ElevateDB Manager and inserted the row successfully:
> INSERT INTO BS
> (rtrr,iban,vrsta,banka,naziv,ulica,hs,naselje,posta,kraj,davcna,maticna,drzava,obcina,vrsta_subjekta,dejavnost,sektor,dtOdprt,dtSprememba,dtzaprt,eno,del_registra,isddv,dtOdprt_dt,dtSprememba_dt,dtZaprt_dt,dtCreated,dtUpdated)
> VALUES (300000000123456,'SI56','T','Volksb.-Ljud.b.  ','DRUŠTVO LJUBITELJEV SONCA        
>  ','BUABCDLAK','086','                                  
> ','3221','TEHARJE',47923903,1644858,'705','011 ','453','10.330','S.15   ','          ','
>         ','15.10.2006',' ','P',False,NULL,NULL,TIMESTAMP '2006-10-15 0:0:0',TIMESTAMP
> '2007-12-2 2:48:44',TIMESTAMP '2007-12-2 2:51:25')
>
> I get the following error when using it in source code:
> "ElevateDB Error #700 An error was found in the statement at line 1 and column 250
> (Missing expression)"
>
> Column 250 is at the '(' after 'VALUES '.
> I am reading data from System.Data.DataTable.
>
> The source:
> foreach (DataRow row in dtSource.Rows)
>             {
>                 string edbInsert = @"INSERT INTO BS
> (rtrr,iban,vrsta,banka,naziv,ulica,hs,naselje,posta,kraj,davcna,maticna,drzava,obcina,vrsta_subjekta,dejavnost,sektor,dtOdprt,dtSprememba,dtzaprt,eno,del_registra,isddv,dtOdprt_dt,dtSprememba_dt,dtZaprt_dt,dtCreated,dtUpdated)
> VALUES (";
>                 
>                 EDBCommand edbCom = new EDBCommand(edbInsert, connEdb);
>                 edbInsert += "" + Convert.ToDouble(row[0].ToString()) + ",";
>                 edbInsert += "'" + row[1].ToString() + "','" + row[2].ToString() + "','" +
> row[3].ToString() + "','" + row[4].ToString() + "','" + row[5].ToString() + "','" +
> row[6].ToString() + "','" + row[7].ToString() + "','" + row[8].ToString() + "','" +
> row[9].ToString() + "',";
>                 int davcna = 0;
>                 bool ddv = Int32.TryParse(row[10].ToString(), out davcna);
>                 edbInsert += (ddv ? davcna.ToString() : "NULL") + ",";
>                 int maticna = 0;
>                 bool mat = Int32.TryParse(row[11].ToString(), out maticna);
>                 edbInsert += (mat ? maticna.ToString() : "NULL") + ",";
>                 edbInsert += "'" + row[12].ToString() + "','" + row[13].ToString() + "','"
> + row[14].ToString() + "','" + row[15].ToString() + "','" + row[16].ToString() + "','" +
> row[17].ToString() + "','" + row[18].ToString() + "','" + row[19].ToString() + "','" +
> row[20].ToString() + "','" + row[21].ToString() + "',";
>                 bool isDDV = false;
>                 bool isIt = Boolean.TryParse(row[22].ToString(), out isDDV);
>                 edbInsert += "" + (isIt ? (isDDV).ToString() : "NULL") + ",";
>                 DateTime dt = new DateTime(1900, 1, 1);
>                 bool date = false;
>                 date = DateTime.TryParse(row[23].ToString(), out dt);
>                 edbInsert += (date) ? ("TIMESTAMP '" + dt.Year + "-" + dt.Month + "-" +
> dt.Day + " " + dt.Hour + ":" + dt.Minute + ":" + dt.Second + "',") : ("NULL,");
>                 dt = new DateTime(1900, 1, 1);
>                 date = false;
>                 date = DateTime.TryParse(row[24].ToString(), out dt);
>                 edbInsert += (date) ? ("TIMESTAMP '" + dt.Year + "-" + dt.Month + "-" +
> dt.Day + " " + dt.Hour + ":" + dt.Minute + ":" + dt.Second + "',") : ("NULL,");
>                 dt = new DateTime(1900, 1, 1);
>                 date = false;
>                 date = DateTime.TryParse(row[25].ToString(), out dt);
>                 edbInsert += (date) ? ("TIMESTAMP '" + dt.Year + "-" + dt.Month + "-" +
> dt.Day + " " + dt.Hour + ":" + dt.Minute + ":" + dt.Second + "',") : ("NULL,");
>                 dt = new DateTime(1900, 1, 1);
>                 date = false;
>                 date = DateTime.TryParse(row[26].ToString(), out dt);
>                 edbInsert += (date) ? ("TIMESTAMP '" + dt.Year + "-" + dt.Month + "-" +
> dt.Day + " " + dt.Hour + ":" + dt.Minute + ":" + dt.Second + "',") : ("NULL,");
>                 dt = new DateTime(1900, 1, 1);
>                 date = false;
>                 date = DateTime.TryParse(row[27].ToString(), out dt);
>                 edbInsert += (date) ? ("TIMESTAMP '" + dt.Year + "-" + dt.Month + "-" +
> dt.Day + " " + dt.Hour + ":" + dt.Minute + ":" + dt.Second + "'") : ("NULL");
>                 edbInsert += ")";
>                 connEdb.Open();
>                 edbCom.ExecuteNonQuery();
>                 connEdb.Clone();
>             }
>
>
Fri, Jan 11 2008 11:38 AMPermanent Link

Matej Kozinc
Yes there is a space ( "...) VALUES (..." ). I created the table again and imported the
data. Now everything works as it should.
Thanks for your help.

Matej

Image