Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > Standard C, C++

Reply
 
LinkBack Thread Tools Display Modes
Old 11-21-2005, 10:06 PM   #1 (permalink)
ashok rajagopal
Registered User
 
ashok rajagopal's Avatar
 
Join Date: Sep 2005
Posts: 20
ashok rajagopal is on a distinguished road
help in C code using client lib function of sybase

We are getting return code = 0 in our code while executing the below function.



ex_use_db is called from our program which in turn executes function ex_execute_cmd() and the database connection is failing here. It goes into the ex_error of the If condition.



the same functions are being invoked by the sample program provided by CS reference manual by sybase and that does not go into the ex_error. (It is giving a return code = 1)

Any idea of what is going wrong ?
ashok rajagopal is offline   Reply With Quote
Old 11-21-2005, 11:15 PM   #2 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 598
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
I think you'll need to post some code. Check all your input parameters and any global variables that are referenced to start. Make sure the sample is linking to the same libraries, check any settings that might affect the functions in question. If all else fails, Sybase is bound to have a support plan.
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Old 11-22-2005, 03:02 AM   #3 (permalink)
ashok rajagopal
Registered User
 
ashok rajagopal's Avatar
 
Join Date: Sep 2005
Posts: 20
ashok rajagopal is on a distinguished road
Code:
if( (ret=ex_connect(context,&connection,"SO_PLATE",gszSqlUser,gszSqlPassword,gszDBServer)) != CS_SUCCEED)
      {
         fLogError("SO_PLATE - Unsuccessful LOGIN on database.");
         fLogError("SO_PLATE - Unsuccessful OPEN on database PMLL.");
                         //return 0;
                         exit(ERREXIT);
      }
              strcpy(sql_string, "USE pmll_test");
              strcat(sql_string,gszDBName);
//it is at this point that i am having the errors.  
      if((ret = ex_execute_cmd(connection,sql_string)) != CS_SUCCEED);
      {
                          fLogError("SO_PLATE - Unsuccessful USE on database PMLL.");
                          //return 0;
                          exit(ERREXIT);
              }
I just wanna know something. the datavalue for connection is being passed as &connection to ex_connect. The data type is CS_CONNECTION *connection. Will the changes that are being made inside the function 'ex_connect' be reflected in the rest of the code ? ex_connect takes in as second parameter a datatype of 'CS_CONNECTION **'

The error i am getting is cos, ct_cmd_alloc function is failing... would like to have some help on how to fix, and what might be the problem....

Last edited by redhead; 11-22-2005 at 03:59 AM.
ashok rajagopal is offline   Reply With Quote
Old 11-22-2005, 04:04 AM   #4 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,726
redhead is on a distinguished road
Are you sure it shouldn't be:
Code:
              strcpy(sql_string, "USE pmll_test ");
              strcat(sql_string,gszDBName);
Note the added space after pmll_test, since when adding gszDBName you'll and up with a string that says "USE pmll_testgszDBName" and since I have no idear what your database name is that you want to use, I'mm guessing it's in this part the error occures.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
need c++ code for streamtokenizer function of java muralikrishna Standard C, C++ 2 11-06-2005 07:00 PM
How to use legacy C code in a C# application otakuj462 MS Technologies ( ASP, VB, C#, .NET ) 2 09-22-2005 08:18 PM
Perplexing Error on C Code etorres Standard C, C++ 6 03-24-2005 09:16 PM
operate overloading member function in C# sureshkumar_kc MS Technologies ( ASP, VB, C#, .NET ) 2 10-15-2004 03:36 AM


All times are GMT -8. The time now is 03:48 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting