Switching companies using SQL Passthrough

I have an application that uses SQL_Passthrough.  As part of the code you 
must execute a statement that uses the appropriate database.  The code looks 
like this:
	set SQL_Statements to "use MYDB";
	status = SQL_Execute(SQL_connection, field SQL_Statements);

This works fine, but my application can be used for any number of databases. 
 At first, I modified it to use the Dex.ini file, which works.  Here is the 
modification:

dbname = Defaults_Read("SQLDB");
dbopencommand = "use " + dbname;
set SQL_Statements to dbopencommand;
status = SQL_Execute(SQL_connection, field SQL_Statements);

However, one of my clients uses multiple companies.  I can't support that 
with the ini file.

Question:
Is there a way to determine the current company and the current database 
they are using so I can fill my dbname variable with whatever current db they 
are using?

Thanks for your help,
Don DeVeux

0
rengeek33 (60)
12/28/2005 5:59:03 PM
greatplains 29623 articles. 6 followers. Follow

1 Replies
654 Views

Similar Articles

[PageSpeed] 48

The 'Intercompany ID' field of the SY_Company_MSTR table is the name of the 
DB which you can then use with the SQL USE command.

You can also use 'Intercompany ID' of globals to obtain the current 
company's DB name.

Hope this helps.

David Musgrave [MSFT]
Senior Development Consultant
Escalation Engineer
MBS Support - Asia Pacific

Microsoft Business Solutions
http://www.microsoft.com/BusinessSolutions

mailto:dmusgrav@online.microsoft.com

Any views contained within are my personal views and 
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties, 
and confers no rights.  


"rengeek33" wrote:

> I have an application that uses SQL_Passthrough.  As part of the code you 
> must execute a statement that uses the appropriate database.  The code looks 
> like this:
> 	set SQL_Statements to "use MYDB";
> 	status = SQL_Execute(SQL_connection, field SQL_Statements);
> 
> This works fine, but my application can be used for any number of databases. 
>  At first, I modified it to use the Dex.ini file, which works.  Here is the 
> modification:
> 
> dbname = Defaults_Read("SQLDB");
> dbopencommand = "use " + dbname;
> set SQL_Statements to dbopencommand;
> status = SQL_Execute(SQL_connection, field SQL_Statements);
> 
> However, one of my clients uses multiple companies.  I can't support that 
> with the ini file.
> 
> Question:
> Is there a way to determine the current company and the current database 
> they are using so I can fill my dbname variable with whatever current db they 
> are using?
> 
> Thanks for your help,
> Don DeVeux
> 
0
dmusgrav1 (1325)
1/4/2006 4:20:02 AM
Reply:

Similar Artilces:

SQL in Excel data
Hi all, Is there a possibility/way to run an SQL query in an excel data sheet? I have quite some data like the sample below, now i would like to have the sum of spending for each person. Like it is possible in Access. A1 B1 Field1 Field2 Chuck 12,89 Mike 23,09 Jean 9,34 Chuck 30,00 Mike 3,80 Chuck 22,00 Mike 7,23 Jean 10,55 Jean 10,75 Jean 31,45 Chuck 19,99 Result Field1 SumOfField2 Chuck 84,88 Jean 62,09 Mike 34,12 Advice would be appriciated. Cheers, Ludovic Hi You could use a formula like this ...

Unable to switch to native mode
I am trying to convert from Mixed to Native mode using the steps in Q272314. Our environment is 4 sites that were upgraded from Exchange 5.5 to Exchange 2k3 and we have moved all mailboxes, public folders to the new servers. I have followed all the steps in the Q article above and made sure that all recipient CA's were removed. I've removed all the Directory Replication Connectors (except ADNAutoDRC) When I get to the final Step 11 and 12 I get an error that the "SRS is function9ing as the bridgehead for one or more directory replication connectors and cannot be deleted.&qu...

Microsoft CRM using Firefox
Hello, Would anyone by chance know if CRM will work correctly on Firefox. Currently, I have employees that are using Firefox and are encountering the same issue as IE [Internet Explorer bombs out and states that it has encountered problems...]. I am just having employees use IE to prevent problem. Thank you for your comments in advance. Install a Firefox extension called IETab "Marcos" <Marcos@discussions.microsoft.com> wrote in message news:19B93E29-757D-46FF-B747-A17EB112ED94@microsoft.com... > Hello, > > Would anyone by chance know if CRM will work cor...

Using iterations to calculate circular references.
I am working with data that requires using circular references in some calculations. I checked the "iterations" box to allow for these calculations to work, and Ecxel seems to be calculating everything correctly. The problem is that after I close the workbook, when I later reopen it to continue working, all the cells that are a part of the circular reference display the #VALUE! error. I can fix this by deleting one cell that is part of the loop and then undoing that command, or by copying the formula from a cell, deleting it, and pasting it back into the same cell. I have to d...

Using crm:5555 rather than a custom hostheader
All I would just like to know what's the recommended solution for a CRM (v3) deployment:- use the standard crm:5555 or a custom hostheader e.g. crm.mycompany.net. Will the custom hostheader cause me any problems? Will external users be able to logon remotely using this host header? Many thanks, Nick. ...

Between using Sumproduct
Is there a way to enter a date value that is between 2 dates in sumproduct or another function that will look at the same column and return the sum of a different column? If the value is greater than May 1,2007 but less than August 31, 2007 in column A it will return the sum of the matching rows in column B. I have tried this with either greater than OR less than and it works but, when I try them in the same sumproduct() it fails. Thanks for reading and any information to the right direction. -- Lee Coleman =SUMPRODUCT(--(A2:A500>=DATE(2007,5,1)),--(A2:A500<=DATE(2007,8,31)),B2...

Repair SQL Corrupt database
Hi, I have a corrupt MS SQL Server 2005 database which I am trying to repair using: DBCC CHECKDB ('MYDB', REPAIR_ALLOW_DATA_LOSS) Unfortunately this does not seem to fix anything. After running the repair multiple times, I ran DBCC CHECKDB ('MYDB') WITH NO_INFOMSGS to see if it fixed the corruption, I noticed that is was returning a random amount of errors on each run. Does any know if It is the case that this database is beyond repair? If so will the best approach be to revert back to a non corrupt database backup and then roll forward using Transaction Lo...

Creating a template using Publisher
I need help creating a neighborhood directory template using Publisher and merging an Excel spreadsheet into it. It keeps printing multiple pages of the first page after I merge. What version Publisher? If you have 2003 use the catalog merge for your directory. http://office.microsoft.com/en-us/assistance/CH010504381033.aspx Otherwise you need to setup your page as though it is labels. Determine the size of the area you need for each entry, select labels in page setup, type the size you determined in the page setup. Adjust the gaps and margins when you are ready to print (2000 and bel...

Is anybody using Symantec Enterprise Vault?
Hi, A vendor has recommended this solution to us, I have looked at the datasheet for the product and it speaks the right language but I was wondering if anybody on here uses it in a live environment and what their opinion of it is. Cheers Sean ...

Server being used to send out viruses
Problem: When I select "Clients can only submit if homed on this server" in the CONNECTIONS tab in the IMC, my remote POP3 users cannot send email through the server. The email just sits in their Outbox. These POP3 clients do have mailboxes (email accounts) on the server so this should work. When I set my server to ACCEPT CONNECTIONS FROM ANY HOST, my server becomes a target for others (as known as evil people) to use my email server to send out viruses. Any ideas? Thanks, everyone who contributes to this forum. This is great! David Hi, If you are using Exchange, w...

Is SQL 2000 tran working with VS2008?
I code a store procedure mySP in SQL 2000 in which using transaction. I used two ways to test after saving sp. 1) rename one table or 2) rename column name If I use "exec mySP" in SQL 2000 query window, error will catch but ASP.NET try-catch will catch nothing, it always return no error. Is SQL 2000 tran working with VS2008? -- Message posted via DotNetMonster.com http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201002/1 On Feb 5, 10:15=A0pm, "aspfun via DotNetMonster.com" <u53138@uwe> wrote: > I code a store procedure mySP in SQL 2000...

Problem when switching datasource
Help please :) I have created an excel report, that retrieves its data from a view. From that data i have created several sheets with different pivottables. The view is based per country, so each country has to connect to their own view. So I use the same file and change the datasource. It looks fine when i have updated. BUT when I use the dropdown on a field, the old values from the last data are still visible, however they dont show anything if you choose them. For example France has sales men a +b and Sweden c+d. when switching datasource from france to sweden, only c+d should be visible i...

Using Sumproduct when some of the values are null
I am having a problem using Sumproduct when some of the cells have null values. I will try to describe the problem. Please let me know if you need additional information. Do any of you have any ideas of how I can fix that sumproduct to get it to work? A B C Row Trend Claims 5 Emergency $0 6 Emergency $0 7 Emergency $0 8 Emergency 81.68% $24,444 9 Emergency 35.00% $164,758 10 Emergency 35.00% ...

Unable to repy using word editor
When repyling to an e-mail I receive the following message, "This form requires Word as your e-mail editor, but Word is either busy, or cannot be found. The form will be opened in the Outlook editor instead". I found article 284900, that states you may get this message when you have office 2000 and office xp installed on the same computer. This is not the case on my computer, Office 2000 does not exist, only office xp. Can anyone help me? There appear to be a whole host of causes for this error message. Most have no solution. Here are a few that do: http://support.microsoft...

Change License / Company name
Hi, we tried CRM 1.2 with the MSDN license key. Now my company bought a 25 user Proffesional Suite license and I want to change the key on the production server. Is there an easy way to do this?? The only solution I see, is via the Data Migration Framework. Erik. How about the re-deploy tool? "Erik" <none> wrote in message news:u0SXdbXlEHA.3452@TK2MSFTNGP15.phx.gbl... > Hi, > we tried CRM 1.2 with the MSDN license key. Now my company bought a 25 > user > Proffesional Suite license and I want to change the key on the production > server. Is there an easy wa...

How do I tell if Frontpage was used to design a website?
The developers of my website are long gone and I know nothing about what they did. I think it was deisgned in Frontpage, bit am not sure. Once I know that I would like to "convert" it to something that would allow me make changes to the site easily...maybe a visual website designer..is there such a thing? To see if your website is designed in FrontPage a Link to your website will help us. CoffeeCup.com Say:: Visual Site Designer is a WYSIWYG Website creator and editor that helps you make WebPages with no experience or HTML knowledge. Just drag and drop images or ...

iPhone Email to Entourage Using Exchange
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel When I answer an email on my iPhone, it does not register it in Entourage as answered. This function worked fine until the business I work for put everyone on Exchange. Is there a setting for this that I can change? <br><br>Thanks! ...

Need help with update sql plus filter
I have the following update sql (copied from the query design view) UPDATE ListQry SET ListQry.ApprovalStatusID = [Forms]![OpeningForm]![Responsibility] WHERE (((ListQry.ApprovalStatusID)<[Forms]![OpeningForm]![Responsibility] And (ListQry.ApprovalStatusID)>-1) AND ((ListQry.OtherStatusID)>300)) OR (((ListQry.ApprovalStatusID)<[Forms]![OpeningForm]![Responsibility] And (ListQry.ApprovalStatusID)>-1) AND ((ListQry.OtherStatusID) Is Null)); ApprovalStatusID is an integer OtherStatusID is an integer ListQry is the recordsource for my form. I would like to add the f...

using backslash ( \ ) inside Parameter
Hi I am trying to use backslash as a part of a parameter at stored procedure. And I am getting syntax error. For instance, to execute like this.. EXEC spSetupPermissions CORP\ABC, Sale with parameter I have set up like this.. CREATE PROC [dbo].[spSetupPermissions] @USERNAME varchar(50), @DEPARTMENT varchar(12) AS IF @DEPARTMENT = 'Sale' BEGIN EXEC Sale.dbo.sp_addlogin @loginame= @USERNAME EXEC Sale.dbo.sp_addrolemember 'db_owner', @USERNAME END ......etc... I should I go about doing this? I would appreciate if anyone would give...

Using backup as import
Can I import a Money 2002 backup file into Money 2007? No but you should be able to restore it. "perple" <perple@discussions.microsoft.com> wrote in message news:0832C8E2-B5EB-4197-954E-03E64F66E32E@microsoft.com... > Can I import a Money 2002 backup file into Money 2007? ...

Stop use of Distribution List
Is there anyway that you can stop, or restrict the use of a distribution list? Since you have so much detail of how you are setup and if there are specific people or groups you want to restrict from using it, I will answer your question with the same amount of detail....YES. Add more detail and we can give you a better answer. "brendanrtw" <brendanrtw@discussions.microsoft.com> wrote in message news:6CB3EB2F-F428-46AD-A41E-A1495B8CF4CD@microsoft.com... > Is there anyway that you can stop, or restrict the use of a distribution > list? On Thu, 3 Nov 2005 12:00:...

question about using the correct schema namespace
I have a Access/VBA client that exports xml to the local drive, then posts it over http to an aspx page. The aspx page consumes it, then builds itself based on the xml data. This works find only if I first mannually change the root entry's namespace url as shown below. Does anyone know how I can get the two (cleint xml export and aspx xml consume) to work together with the appropriate namespace? Here is the top three lines of my xml export (prior to mannually changing it): <?xml version="1.0" encoding="UTF-8"?> <root xmlns:xsd="http://www.w3.org/200...

using dates Part 2
Karl was great in helping me get to this point with dates, now I'm wondering if we can take it 1 step further? For Activity Dates prior to 2/1/2007 they are using a normal reporting year and the formulas below take care of Activity dates >2/1/2007? So for example prior to 2/1/2007 1/1/2006 would have a B_Qtr of 2006-1 1) B_Qtr - 2011-1 --- Format(DateAdd("m",11,[ActivityDate]), "yyyy - q") 2) Year - 2011 ---- Year(DateAdd("m",11,[ActivityDate])) 3) Qtr - Q1 ---- Format(DateAdd("m",11,[ActivityDate]), "q") -- Than...

SDI: Switching between main SDI app windows
I want to be able to allow the end-user to pick between medium and large font sizes for the various controls on the main SDI application window. This windows has several radio-button-groups, a CTreeCtrl, and a CRichEditCtrl. When I use the form editor to lay out the main SDI app window, I'm now using Arial 8. If I change the Properties for the entire window to something larger (like Arial 10 or 14), then all the controls have the font-size increased, and the controls themselves get bigger. This seems like an easier approach than changing the font size for each control, and figuri...

Installing Outlook 2003 using Custom Wizard
I am installing Outlook 2003 using the custom installation wizard. This was working fine for some time. Now, someone in my group must have modified the settings because when I install Office using this MST file the local Outlook Contacts are not showing in the GAL. When I go to the properties and try to add it the check box for "Show this folder as an email address book" is greyed out. I have to go in and manually add the Outlook Address book. Can anyone tell me what setting I can change in my Outlook custom install settings for the MST to make this available by default? ...