The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Datagrid connect to data store in other db
Posted: 09 Feb 10 10:06 AM
|
I want to create a datagrid with display data stored in other db. I can to link an another db for memory into recordset but i don't can view in a datagrid.
EXAMPLE:
datagrid1.ConnectionString="Provider=SQLOLEDB.1"&"Initial Catalog=mep19;"&"Data Source=(local);User ID=DBA;"&"Password=sqlsql " ssql="Select orpa_c_cli_for from flusso_orpa'" datagrid1.sql = ssql datagrid1.Refresh
but what i do in datagrid.columns?? i don't view data.
EXAMPLE TO CONNECT (the code function correctly) :
Set sconn=CreateObject("ADODB.Connection") conn="Provider=SQLOLEDB.1"&"Initial Catalog=mep19;"&"Data Source=(local);User_ ID=DBA;"&"Password=sqlsql " sconn.Open conn Set objSLXDB= New SLX_DB Set objRS=objSLXDB.GetNewRecordSet objRS.Open "Select orpa_c_cli_for from flusso_orpa ",conn objRS.MoveFirst msgbox objRS.fields(0)
|
|
|
|
Re: Datagrid connect to data store in other db
Posted: 09 Feb 10 3:40 PM
|
Why not put a view of the other db in your SLX database (owned by sysdba) and use that directly?
If for some reason that is not workable, this line looks suspect:
datagrid1.ConnectionString="Provider=SQLOLEDB.1"&"Initial Catalog=mep19;"&"Data Source=(local);User ID=DBA;"&"Password=sqlsql "
There are no variables here, so why are you concatenating everything using &? Why not just write it as one long string? |
|
|
|
Re: Datagrid connect to data store in other db
Posted: 10 Feb 10 4:11 AM
|
because the other db is db2 and i don't can to put view into SLX database. For the string you have reason but the problem is another. How can to put view in SLX database? I think to use server linked in SQL Server but i don't, can to link. |
|
|
|
Re: Datagrid connect to data store in other db
Posted: 10 Feb 10 4:59 AM
|
If you can create a linked server you can probably do this - sounds like you might need some help from your DBA, who will also help you with the syntax for creating the view ... |
|
|
|