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!
|
|
How to make a DB connection
Posted: 04 Aug 08 7:14 AM
|
Hi, I am rtying to make a DB connection and fetch data of a particular field based on some event like click of a buton. Can any body suggest me on how to proceed on this. I am not finding any hint from the existing code or architect on how to start this task.
Thanks in advance
Mallikarjun |
|
|
|
Re: How to make a DB connection
Posted: 07 Aug 08 1:16 PM
|
.. script file is available in SalesLogix for this include that file in your form 'Including Script - System:SLX Database Support
dim objDB dim objSLXDB dim objRS Set objDB = New SLX_DB Set objSLXDB = new SLX_DB Set objRS = objSLXDB.GetNewRecordset
'exception handling for connection while creating recordset If ErrorCheck (Application.Translator.Localize("Error getting connection information:")) > 0 Then Exit sub
strSQL = "SELECT count(contactid),sum(AccountValue) from DI_AssetSummary where userId = '"& strUserId &"' and " &_ " contactId = '" & strContactID & " ' "
'Get a RecordSet object for the given SQL query objRS.Open strSQL, objSLXDB.Connection
'exception handling for while accessing database If ErrorCheck (Application.Translator.Localize("Error accessing database:")) > 0 Then objRS.Close Set objRS = Nothing Exit sub End If
If (Not objRS.BOF) And (Not objRS.EOF) Then iTotalRecords = objRS.Fields(0).Value fTotalValue = objRS.Fields(1).Value End If
or you can define your own connection string as follows..
dim objConnection dim strConnection
Set objConnection = CreateObject("ADODB.Connection") strConnection = "Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsernameassword=myPassword;"
objConnection.Open strConnection (you can change the strConnection as your requrement)
HOPE THIS WILL HELP YOU. -Harendra
|
|
|
|
Re: How to make a DB connection
Posted: 07 Aug 08 11:13 PM
|
Hi Harendra,
I dont think so it is for black berry client i feel you are talking about LAN client or Web client. I am working on Blackberry client. Correct if i am worng.
Regards Mallikarjun |
|
|
|
Re: How to make a DB connection
Posted: 08 Aug 08 7:08 AM
|
The example provided is definately lan script code and does not refer to Java BB device code. You will have to look into some of the java classes for examples of this specifically. You will need to use the query object to get back what you are looking for. Currently I do not have time to come up with an example but there should be enough to go on in existing core code to muck your way through.
Mark |
|
|
| |
|