Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 22-08-2005
Shidalis Shidalis is offline
Miembro
 
Registrado: jul 2005
Posts: 106
Poder: 19
Shidalis Va por buen camino
Disculpen de verdad que no los entienda, ya yo les habia hablado en una de las repuestas anteiores de la funcion SQLConfigDataSource(); y no se cual es la Api que usa el ODBC porque el delphi no me acepta la funcion y con respecto a lo que me explica Maeyanes de verdad no lo entiendo por favor si puedes ser mas explicito te lo agradeceria
Responder Con Cita
  #2  
Antiguo 23-08-2005
Avatar de lucasarts_18
lucasarts_18 lucasarts_18 is offline
Miembro
 
Registrado: mar 2005
Ubicación: Villa Alemana,Chile
Posts: 1.087
Poder: 21
lucasarts_18 Va por buen camino
Hola:

aquí hay otro enlace..

http://msdn.microsoft.com/library/de...datasource.asp

Delphi no te está tomando la función porque seguramente no la has declarado..y me gustaría ayudarte pero no soy un experto del tema, a ver si alguien del foro sabe esto...esperemos que sí y aprendemos todos..

Saludos..
__________________
No todo es como parece ser...
Responder Con Cita
  #3  
Antiguo 23-08-2005
Avatar de lucasarts_18
lucasarts_18 lucasarts_18 is offline
Miembro
 
Registrado: mar 2005
Ubicación: Villa Alemana,Chile
Posts: 1.087
Poder: 21
lucasarts_18 Va por buen camino
Hola:

Aquí encontré un ejemplo que llama a una función específica del API del ODBC.

Código Delphi [-]
 
   function SQLGetInfo(hDb: Longint; InfoType: Word; Info: pointer; Len: Integer;
              var RetLen: Integer): Integer; far; external 'ODBC' index 45;

Aquí está accediendo a una DLL, especifícamente a una del ODBC..

Aquí está todo el código completo..

Código Delphi [-]
 
 {$A+,B-,D+,F-,G+,I+,K+,L+,N+,P+,Q-,R-,S+,T-,V+,W-,X+,Y+}
 {$M 20480,4096}
 unit main;
 
 { SETUP:
     1) Make sure an ODBC Data Source is configured in the BDE correctly.
     2) The program must have access to the ODBC.DLL.
     3) Configure the TDatabase Object to open an ODBC Data Source.
     4) Run program.
 }
 interface
 
 uses
   Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
   StdCtrls, DB, DBTables, Grids, DBGrids, DbiTypes, DbiErrs, DbiProcs;
 
 type
   TMainForm = class(TForm)
     ODBCDb: TDatabase;
     GetODBCInfo: TButton;
     OutMemo: TMemo;
     procedure FormCreate(Sender: TObject);
     procedure GetODBCInfoClick(Sender: TObject);
   private
     { Private declarations }
   public
     { Public declarations }
   end;
 
 var
   MainForm: TMainForm;
 
 implementation
 
 {$R *.DFM}
 
 const
   MaxLen = 100;
   { These are ODBC Constants for the SQLGetInfo function }
   SQL_DATABASE_NAME = 16;
   SQL_DRIVER_NAME = 6;
   SQL_DATA_SOURCE_NAME = 2;
   SQL_DRIVER_VER = 7;
   SQL_USER_NAME = 47;
   SQL_MAX_TABLE_NAME_LEN = 35;
   SQL_SERVER_NAME = 13;
 
 { Call the SQLGetInfo function within the ODBC.DLL.  By using the TDUMP
   utility, you can get the function names and indexes. }
 function SQLGetInfo(hDb: Longint; InfoType: Word; Info: pointer; Len: Integer;
              var RetLen: Integer): Integer; far; external 'ODBC' index 45;
 
 procedure TMainForm.FormCreate(Sender: TObject);
 begin
   { Clear the Memo and open the database. }
   OutMemo.Lines.Clear;
   ODBCDb.Open;
 end;
 
 { This function is all you need to setup ODBC calls.  The DbiGetProp
   will retrieve the Native ODBC Handle so ODBC call can be made. }
 procedure TMainForm.GetODBCInfoClick(Sender: TObject);
 var
   DBInfo: array[0..MaxLen] of char;
   NumRead: Integer;
   Len: Word;
   VersionInfo: Integer;
   hNatDb: longint; { Native Db handle that is used for the ODBC functions}
 
 begin
   OutMemo.Lines.Clear;
   { Get the Native ODBC database handle. }
   Check(DbiGetProp(hDbiObj(ODBCDb.Handle), dbNATIVEHNDL, @hNatDb,
              sizeof(hNatDb), Len));
 
   { Call the ODBC function and display the results. }
   OutMemo.Lines.Add('Native Database Handle: ' + IntToStr(hNatDb));
   SQLGetInfo(hNatDb, SQL_DATABASE_NAME, @DBInfo, MaxLen, NumRead);
   OutMemo.Lines.Add('Database Name: ' + StrPas(DBInfo));
   SQLGetInfo(hNatDb, SQL_DRIVER_NAME, @DBInfo, MaxLen, NumRead);
   OutMemo.Lines.Add('Driver Name: ' + StrPas(DBInfo));
   SQLGetInfo(hNatDb, SQL_DATA_SOURCE_NAME, @DBInfo, MaxLen, NumRead);
   OutMemo.Lines.Add('Data Source Name: ' + StrPas(DBInfo));
   SQLGetInfo(hNatDb, SQL_DRIVER_VER, @VersionInfo, sizeof(VersionInfo), NumRead);
   OutMemo.Lines.Add('Driver Version: ' + IntToStr(VersionInfo));
   SQLGetInfo(hNatDb, SQL_USER_NAME, @DBInfo, MaxLen, NumRead);
   OutMemo.Lines.Add('User Name: ' + StrPas(DBInfo));
   SQLGetInfo(hNatDb, SQL_MAX_TABLE_NAME_LEN, @VersionInfo, sizeof(VersionInfo), NumRead);
   OutMemo.Lines.Add('Maximum Table Name Length: ' + IntToStr(VersionInfo));
   SQLGetInfo(hNatDb, SQL_SERVER_NAME, @DBInfo, MaxLen, NumRead);
   OutMemo.Lines.Add('Server Name: ' + StrPas(DBInfo));
 end;
 end.

Espero que te sirva o sino a seguir averiguando...
Roman tiene razón, es una regla del foro no repetir hilos con el mismo tema, despues se hace más difícil buscar en el foro, si algún día alguien tiene un problema similar..

Saludos.
__________________
No todo es como parece ser...
Responder Con Cita
  #4  
Antiguo 24-08-2005
Shidalis Shidalis is offline
Miembro
 
Registrado: jul 2005
Posts: 106
Poder: 19
Shidalis Va por buen camino
probe el codigo y cuando se ejecuta me dice no encuentra la ODBC.dll
Responder Con Cita
  #5  
Antiguo 24-08-2005
Avatar de lucasarts_18
lucasarts_18 lucasarts_18 is offline
Miembro
 
Registrado: mar 2005
Ubicación: Villa Alemana,Chile
Posts: 1.087
Poder: 21
lucasarts_18 Va por buen camino
Cita:
Empezado por Shidalis
probe el codigo y cuando se ejecuta me dice no encuentra la ODBC.dll
El ejemplo que te envié es para una aplicación Windows de 16 bit, trata con ODBC32.DLL

Saludos.
__________________
No todo es como parece ser...
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 18:58:16.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi