on 06-19-2008 7:45 AM
Hello Everyone,
I have a function in SQL Server which i use in one of my UDO Screens.This works fine in current company. But when i make an addon and run it in new company error occurs as to the function was not found. Now i know that the function written in current company is not available in new company.
My question is how to package the function in my coding so that when i create an Addon,the function is automatically created in whichever company i run it in. Hope i'm clear in explaining the problem.Please help as this is the final hurdle in creating Addon.
Hi Raghu,
usually i did this with an ADO Recordset in past, because
than you can create a Query that creates the Function.
i help you as much as i can and provide you this vb6 sample:
Dim oDBConnection As ADODB.Connection
Dim oDBRecordSet As ADODB.Recordset
Dim oDBConnection As ADODB.Connection
Dim oDBRecordSet As ADODB.Recordset
Dim sDBServerName As String
Dim sDBCompanyDBName As String
Dim sDBUserName As String
Dim sDBUserPasswd As String
Dim sConnectionString As String
Dim pCommand As String
Set oDBConnection = New ADODB.Connection
Set oDBRecordSet = New ADODB.Recordset
sDBServerName = oCompany.Server
sDBCompanyDBName = oCompany.CompanyDB
sDBUserName = B1C_DBUser
sDBUserPasswd = B1C_DBPasswd
sConnectionString = "driver={SQL Server}; Server=" & sDBServerName & "; Initial Catalog=" & sDBCompanyDBName & "; User ID=" & sDBUserName & "; Password=" & sDBUserPasswd
oDBConnection.open sConnectionString
pCommand = "CREATE - INSERT YOUR SQL CODE"
DBRecordSet.open pCommand, oDBConnection
important is that you have the Microsoft Active X Data Objects 2.7 Library included !
much luck
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Raghu,
without correct password you arent able to create the function on sql server. My suggestion is create it with the password you have and in case, that the error from sql server is incorrect passwrod, show to user inputbox for writing correct password and connect the recordset with given password.
Actually the first time i hardcoded the password.Now that the client has a new server the sa password is different. So i dont want this siutation to reoccur. But if i pass the password as
company.dbpassword
its only picking up ********* and not the password.Since i use this function in one of my addons i need to create this function in whichever company or server the client connects to.Any suggestion otherwise.
Hi guys
A Sapbobs Recordset did the trick.
i Forgot that recordset would execute watever query u give it.
So i gave it like this
rs.DoQuery(pcommand)
where pcommand has the function i need.Just that before this i need to check from sysobjects if such a function exists. Why didnt i think of this before.
Thanks any way guys you opened a new vista.
Also please do look into the Visual source safe XML corruption and throw some light on it
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.