Page 1 of 1

Browse with SQL server 2005

Posted: Sun Dec 28, 2008 12:59 pm
by Cartago
Greetings to all. I was trying to access SQL Server 2005, with the following connection string:

CnAdo := CreateObject("ADODB.Connection")
CnAdo:Open("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=CART-1BE1F478D8\SQLEXPRESS;Initial File Name=C:\Archivos de programa\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf")
oCursor := CreateObject("ADODB.Recordset")


But the question is how do I get data from a table of SQL Server 2005 are shown in a browser?
Thank you. ;)

Re: Browse with SQL server 2005

Posted: Sun Dec 28, 2008 6:02 pm
by luisvasquezcl
Hi Cartago,

The only solution is to use one you have to upload the data grid.
best regards,

Luis Vasquez

Re: Browse with SQL server 2005

Posted: Sun Dec 28, 2008 7:12 pm
by Cartago
Hi, luisvasquezcl.
Then, save the query in an array and the array is showing the browse/grid?
Many thanks.

Re: Browse with SQL server 2005

Posted: Fri Jan 09, 2009 9:15 am
by mol
Hi!
Can you put any working example how to browse and update data from MS SQL Server?

Marek

Re: Browse with SQL server 2005

Posted: Tue Jan 13, 2009 8:07 pm
by luisvasquezcl
Hi Marek,

#include 'minigui.ch'
#include 'adodb.ch'

Definition of the main window
Procedure Main
Local oConnection := TOleauto():New('ADODB.Connection')
Local oSql := TOleauto():New('ADODB.Recordset')
oConexion:ConnectionString ='Provider=Microsoft.Jet.OLEDB.4.0;'+;
'Data Source=MyTable.mdb;'+;
'User Id=Admin;'+;
"Password=;"
oConexion:Open()

oSql:CursorLocation = adUseClient
oSql:Open( "Select * From Client", oConnection, adOpenDynamic, adLockOptimistic )
if oSql:State = adStateClose
Msgstop('Error open table')
Endif


DEFINE WINDOW form1 .... etc... MAIN On Init LoadData(oSql)
DEFINE GRID grid_1
ROW 0
COL 0
etc....
END GRID
END WINDOW
form1.activate
Return

assuming you have a table name and phone fields have the following functions to load data:

Procedure LoadData( oSql )
form1.grid_1.deleteallitems
do while !oSql:eof()
form1.grid_1.additem( { oSql:fields(0):Value, oSql:Fields(1):Value } )
oSql:MoveNext()
enddo
return

you can change the fields position with fieldsname for example:

form1.grid_1.additem( { oSql:Fields('Name'):Value, oSql:Fields('Phone'):Value } )

I hope you will be useful
regards
Luis Vasquez

Re: Browse with SQL server 2005

Posted: Tue Jan 13, 2009 8:52 pm
by mol
many thanks Luis.
I will test it if I find some free time.
I need to move my one database to Oracle, and I don't know how to do it...

best regards, Marek

Re: Browse with SQL server 2005

Posted: Wed Jan 14, 2009 8:02 pm
by luisvasquezcl
Hi Marek.
on page www.connectionstrings.com exist there is a way to connect to an Oracle or other database.
regards,
Luis Vasquez

Re: Browse with SQL server 2005

Posted: Thu Jan 15, 2009 8:29 am
by mol
How to update changed data to database?
Marek

Re: Browse with SQL server 2005

Posted: Mon Jan 26, 2009 12:40 pm
by Cartago
Hello, Marek.
With regard to the connection strings if you want to do it fast, you can use a udl file extension, which works as an assistant. You can also switch to Oracle.

You said how:
http://msdn.microsoft.com/en-us/library ... S.71).aspx

Once you create the connection you want to go back to the txt file, open it and copy the last line, which is the connection string.
Regards.

P.S.: Excuse my poor English.

Re: Browse with SQL server 2005

Posted: Wed Nov 14, 2018 1:24 am
by Ismach
amigos Si quieren conectar ORACLE vean el posting ==> http://www.hmgforum.com/viewtopic.php?f=14&t=4362