Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, June 7, 2025 
 
slxdeveloper.com Community Forums  
   
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!
 Architect Forums - SalesLogix .NET Extensions
Forum to discuss the use of .NET Extensions in SalesLogix version 7 and higher. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix .NET Extensions | New ThreadView:  Search:  
 Author  Thread: function to get New SLX Id however...
RJ Eaton
Posts: 234
 
function to get New SLX Id however...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jun 07 1:31 PM
I have found this function to generate SLX Tables Id's from a VB application. However it doesn't seem to be returning me anything.. or I am not extracting the data correctly..

++++++++++ CODE ++++++++
I call this from a line ..

.Fields("C_WebQQ_ActiveId").Value = CreateSlxID("C_WEBQQ_Active", 1)



Function CreateSlxID(ByVal Table As String, ByVal Q As Integer) As Data.OleDb.OleDbDataReader
Stop
Dim SlxConn2 As New OleDb.OleDbConnection
Dim cmd As New OleDb.OleDbCommand("slx_dbids('" & Table & " ', " & Q & ")", SlxConn2)
SlxConn2.ConnectionString = "Provider=SLXOLEDB.1;Data Source=DevNyApp02;Initial Catalog=Dev_CAI_7;User ID=Adminassword=""ersist Security Info=True;Extended Properties= PORT=1706;LOG=ON;"
SlxConn2.Open()
CreateSlxID = cmd.ExecuteReader()
SlxConn2 = Nothing
End Function

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

However it is not returning me anything... Any hints..??
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: function to get New SLX Id however...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jun 07 1:46 PM
Your function is returning an OleDbDataReader, not a string.

You'd have to use it like this:

Dim r As OleDbDataReader = CreateSlxID("account", 1)
If r.Read() Then
MessageBox.Show("New ACCOUNTID: " & r(0).ToString())
End If


If you want it to return a string you'd change it to this (changes in bold):

Function CreateSlxID(ByVal Table As String) As String
Dim SlxConn2 As New OleDb.OleDbConnection
Dim cmd As New OleDb.OleDbCommand("slx_dbids('" & Table & " ', 1)", SlxConn2)

SlxConn2.ConnectionString = "MYSLXCONNSTRING"
SlxConn2.Open()
CreateSlxID = cmd.ExecuteScalar()

cmd.Dispose()
SlxConn2.Dispose()
End Function


Of course, if you're returning a simple string then you can't return multiple, only a single ID, so no need for the second param for the function. Then you could use it like this:

.Fields("C_WebQQ_ActiveId").Value = CreateSlxID("C_WEBQQ_Active")


Make sense?

-Ryan
[Reply][Quote]
RJ Eaton
Posts: 234
 
Re: function to get New SLX Id however...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Jun 07 11:42 AM
Thanks Ryan, I have it running now.. good piece of code to keep off to the side ..
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/7/2025 1:03:44 PM