Tuesday, 20 March 2012
Connect to another db on the same server
same server? I've got a stored proc in "EducationData" database that needs
to call a SELECT on table "tblStudents" on the "Directory" database. This is
on SQL Server 2000.
Also, I've installed the Books Online from here:
http://www.microsoft.com/downloads/...ng=en#filelist,
but it's asking to do a repair on the current installation and still not
showing up on my start menu. Am I looking in the right place?
Thanks for your help.dw wrote:
> Hi. How does one programmatically do a SELECT on another database on the
> same server? I've got a stored proc in "EducationData" database that needs
> to call a SELECT on table "tblStudents" on the "Directory" database. This
is
> on SQL Server 2000.
> Also, I've installed the Books Online from here:
> http://www.microsoft.com/downloads/...ng=en#filelist,
> but it's asking to do a repair on the current installation and still not
> showing up on my start menu. Am I looking in the right place?
> Thanks for your help.
Try to do "Select * from directory..tblstudents"|||Use master -- You don't have to do this, I'm just showing you that you're
not in the pubs or Northwind database
GO
Select * from SERVERNAME.pubs.dbo.titles
select * from SERVERNAME.Northwind.dbo.Products
"dw" <cougarmana_NOSPAM_@.uncw.edu> wrote in message
news:%23jhZrotmGHA.5076@.TK2MSFTNGP02.phx.gbl...
> Hi. How does one programmatically do a SELECT on another database on the
> same server? I've got a stored proc in "EducationData" database that needs
> to call a SELECT on table "tblStudents" on the "Directory" database. This
is
> on SQL Server 2000.
> Also, I've installed the Books Online from here:
>
http://www.microsoft.com/downloads/...ng=en#filelist,
> but it's asking to do a repair on the current installation and still not
> showing up on my start menu. Am I looking in the right place?
> Thanks for your help.
>|||Thanks, sloan and Maninder :)
"Maninder" <msdhanjal@.gmail.com> wrote in message
news:1151517486.289024.101700@.j72g2000cwa.googlegroups.com...
> dw wrote:
> Try to do "Select * from directory..tblstudents"
>
Sunday, 12 February 2012
Configuring Flat File Connection Programmatically?
I am programmatically creating a package in c#. I need this package to contain a flat file connection manager. I have been successfully able to create the connection manager with the following code:
Package p = new Package(); //New package
ConnectionManager cm = p.Connections.Add("FLATFILE"); //Add a flat file connection manager
cm.ConnectionString = "C:\Dev\myTestFile.txt"; //Set up the connection string
At this point, I want to configure the flat file specific properties of the connection manager (RowDelimiter, HeaderRowDelimiter, etc.). The problem is that the properties collection of the ConnectionManager object is read only. I think I could access the inner object of the connection manager and set the properties in the following way:
ConnectionManagerFlatFileClassffClass = (ConnectionManagerFlatFileClass) cm.InnerObject; //Get the inner object
ffClass .RowDelimiter = "{LF}"; //Set the properties here
Even if this would work, I do not like the solution b/c the BOL states that the ConnectionManagerFlatFileClass "supports the SQL Server 2005 infrastructure and is not intended to be used directly from your code". Does anyone know the "right" way to set these properties?
Many thanks in advance!
David
Figured it out - it looks like I spoke too soon - the BOL does indeed state how to do this:
cm.Properties["RowDelimiter"].SetValue(cm, "LF");