Showing posts with label application. Show all posts
Showing posts with label application. Show all posts

Thursday, March 29, 2012

Cretae a view in one DB with a stored procedure from another DB

Hi,

Ik created an application with visuals basic.NET. This has a
connection string to one database, let's say 'A'. In this database a
stored procedure is called which should execute a string (which is
passed by the) VB tool. This string is a CREATE VIEW statement en this
should be executed in another database let's say 'B'.

I tried this in Transact - SQL

EXEC('USE B;' + Query)

An error occurs : CREATE VIEW should be the first in a batched
statement.

Could anyone help me with this one?

Greetz,
Hennie"Hennie de Nooijer" <hdenooijer@.hotmail.com> wrote in message
news:191115aa.0405240403.724292f@.posting.google.co m...
> Hi,
> Ik created an application with visuals basic.NET. This has a
> connection string to one database, let's say 'A'. In this database a
> stored procedure is called which should execute a string (which is
> passed by the) VB tool. This string is a CREATE VIEW statement en this
> should be executed in another database let's say 'B'.
> I tried this in Transact - SQL
> EXEC('USE B;' + Query)
> An error occurs : CREATE VIEW should be the first in a batched
> statement.
> Could anyone help me with this one?
> Greetz,
> Hennie

You need a GO right before the CREATE VIEW statement, and this won't work in
dynamic SQL. In any case, this isn't really a good way to create a database
object - it would probably be a lot easier for your client application to
connect directly to database B. Or if you really want to do it from SQL,
then why not create the stored procedure in database B and call it from
database A?

It might help if you can explain what you're trying to achieve, and someone
may be able to suggest a better solution, as creating objects dynamically
from a user application can create significant problems with security and
maintenance. But since you didn't say what your goal is, you may have a good
reason for doing this.

Simon

Credentials in Reporting Services?

I have created several reports in SQL Server 2005 reporting services and I am viewing those reports in my C# application using a report viewer control. I want to pass the credentials for each report through my applications. I do not want to use any web service.

Is it possible?

Any help will be appreciated!!!

TIA

YOu can use the URL Parameters to pass the username and the password, look in the BOL for more information, the syntax for that is:

prefix:datasourcename=value

as the prefix is dsu (for user) or dsp (for password)

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

Thanks for your reply Jens!!!

But I am using a Report Viewer control in my application. How can I pass the username and password in this case?

|||Hi,
Hope this could help you

System.Net.CredentialCache myCache = new System.Net.CredentialCache();
myCache.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic", new System.Net.NetworkCredential("user", "pass"));

reportViewer.ShowCredentialPrompts = false;
reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache;
reportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
reportViewer.ServerReport.ReportServerUrl ="http://localhost/reportserver";
reportViewer.ServerReport.ReportPath = "/yourReportFolder/" + "yourReportName";
reportViewer.PromptAreaCollapsed = false;
reportViewer.RefreshReport();

|||

I am trying to use the example code provided for a simialr problem but the line (in VB)

reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache

always shows as read only. How do I get round this please?

|||Hi ,
I think your using report viewer web control ofr asp.net. I had same problem.
Its won't work for Microsoft.Reporting.WebForms.ReportViewer.


But i hope this link could help you..

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=373983&SiteID=1

If you found the way please post back here.


Thanks & Best Regards|||

I am attempting to secure my reports with Windows Authentication, but allow users of my application to access it from the www and supply credentials through my app. My app is a .Net 2.0 Windows SmartClient, and I am using the ReportViewer control.

I tried the following suggestion:

reportViewer1.ServerReport.ReportServerUrl = new Uri(_txtServer.Text);

reportViewer1.ServerReport.ReportPath = _listBox.Items[_listBox.SelectedIndex].ToString();

reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;

CredentialCache cc = new CredentialCache();

cc.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic",

new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text));

reportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = cc;

reportViewer1.ShowCredentialPrompts = false;

reportViewer1.RefreshReport();

...But I still get "The request failed with HTTP status 401: Access Denied." I am able to authenticate with the web service directly when requesting a list of available reports like this:

ReportingService rService = new ReportingService();

rService.Credentials

= new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text);

CatalogItem[] catalogItems;

catalogItems = rService.ListChildren("/", true);

Why can I pass windows credentials to the web service directly, but not through the reportViewer call to reporting services? Any help would be very much appreciated!

|||

Hi Glenn,

You might have got the solution for your problem, If not and/or for other developers who might visit this blog, please find the solution at following link. Actually you can get it work by setting ImpersonationUser instead of NetworkCredentials property.

http://blogs.msdn.com/bimusings/archive/2005/11/05/489423.aspx

|||

You can refer following link.

http://msdn2.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials(VS.80).aspx

|||

Hi, you can try this, might help.

I pass the datasource credential through ReportViewer. It is the acutal database login credential instead of a net work credential. So in my application, which login user has nothing to do with Windows

network login user, I am using my application's user id and password to connect to datasource.

By doing this way, I can view a report using diffirent user id/password as long as they exist in the actual database.

It works for me.

private void Form1_Load(object sender, EventArgs e)

{

.............................

Microsoft.Reporting.WinForms.DataSourceCredentials myCredential = new Microsoft.Reporting.WinForms.DataSourceCredentials();

myCredential.UserId = "myuserid";

myCredential.Password = "mypassword";

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

DataSourceCredentials[] myCredentials=null;

if (reportdatasourcecollection.Count > 0)

{

myCredentials = new DataSourceCredentials[reportdatasourcecollection.Count];

}

for (int iIndex = 0; iIndex < reportdatasourcecollection.Count; iIndex++)

{

ReportDataSourceInfo datasourceinfo = reportdatasourcecollection[iIndex];

myCredential.Name = datasourceinfo.Name;

myCredentials[iIndex] = myCredential;

}

this.reportViewer1.ServerReport.SetDataSourceCredentials( myCredentials );

...............................

}

|||

Hi,

I am facing the same problem.

I used ReportDataSourceInfo then it gives error that DataSource doesnt support it. Error of rsdatasource

So what should be the Connection Methods in Shared DataSource?

Nilesh

|||

Me too there's an error here.

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

any thoughts please?

thanks.

|||

Ishwar,

Thanks for the link. That is awesome. I got it working using the following code.

ServerReport.ReportServerCredentials.NetworkCredentials

= new NetworkCredential(properties.Username, properties.Password, properties.Domain);

Credentials in Reporting Services?

I have created several reports in SQL Server 2005 reporting services and I am viewing those reports in my C# application using a report viewer control. I want to pass the credentials for each report through my applications. I do not want to use any web service.

Is it possible?

Any help will be appreciated!!!

TIA

YOu can use the URL Parameters to pass the username and the password, look in the BOL for more information, the syntax for that is:

prefix:datasourcename=value

as the prefix is dsu (for user) or dsp (for password)

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

Thanks for your reply Jens!!!

But I am using a Report Viewer control in my application. How can I pass the username and password in this case?

|||Hi,
Hope this could help you

System.Net.CredentialCache myCache = new System.Net.CredentialCache();
myCache.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic", new System.Net.NetworkCredential("user", "pass"));

reportViewer.ShowCredentialPrompts = false;
reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache;
reportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
reportViewer.ServerReport.ReportServerUrl ="http://localhost/reportserver";
reportViewer.ServerReport.ReportPath = "/yourReportFolder/" + "yourReportName";
reportViewer.PromptAreaCollapsed = false;
reportViewer.RefreshReport();

|||

I am trying to use the example code provided for a simialr problem but the line (in VB)

reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache

always shows as read only. How do I get round this please?

|||Hi ,
I think your using report viewer web control ofr asp.net. I had same problem.
Its won't work for Microsoft.Reporting.WebForms.ReportViewer.


But i hope this link could help you..

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=373983&SiteID=1

If you found the way please post back here.


Thanks & Best Regards|||

I am attempting to secure my reports with Windows Authentication, but allow users of my application to access it from the www and supply credentials through my app. My app is a .Net 2.0 Windows SmartClient, and I am using the ReportViewer control.

I tried the following suggestion:

reportViewer1.ServerReport.ReportServerUrl = new Uri(_txtServer.Text);

reportViewer1.ServerReport.ReportPath = _listBox.Items[_listBox.SelectedIndex].ToString();

reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;

CredentialCache cc = new CredentialCache();

cc.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic",

new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text));

reportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = cc;

reportViewer1.ShowCredentialPrompts = false;

reportViewer1.RefreshReport();

...But I still get "The request failed with HTTP status 401: Access Denied." I am able to authenticate with the web service directly when requesting a list of available reports like this:

ReportingService rService = new ReportingService();

rService.Credentials

= new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text);

CatalogItem[] catalogItems;

catalogItems = rService.ListChildren("/", true);

Why can I pass windows credentials to the web service directly, but not through the reportViewer call to reporting services? Any help would be very much appreciated!

|||

Hi Glenn,

You might have got the solution for your problem, If not and/or for other developers who might visit this blog, please find the solution at following link. Actually you can get it work by setting ImpersonationUser instead of NetworkCredentials property.

http://blogs.msdn.com/bimusings/archive/2005/11/05/489423.aspx

|||

You can refer following link.

http://msdn2.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials(VS.80).aspx

|||

Hi, you can try this, might help.

I pass the datasource credential through ReportViewer. It is the acutal database login credential instead of a net work credential. So in my application, which login user has nothing to do with Windows

network login user, I am using my application's user id and password to connect to datasource.

By doing this way, I can view a report using diffirent user id/password as long as they exist in the actual database.

It works for me.

private void Form1_Load(object sender, EventArgs e)

{

.............................

Microsoft.Reporting.WinForms.DataSourceCredentials myCredential = new Microsoft.Reporting.WinForms.DataSourceCredentials();

myCredential.UserId = "myuserid";

myCredential.Password = "mypassword";

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

DataSourceCredentials[] myCredentials=null;

if (reportdatasourcecollection.Count > 0)

{

myCredentials = new DataSourceCredentials[reportdatasourcecollection.Count];

}

for (int iIndex = 0; iIndex < reportdatasourcecollection.Count; iIndex++)

{

ReportDataSourceInfo datasourceinfo = reportdatasourcecollection[iIndex];

myCredential.Name = datasourceinfo.Name;

myCredentials[iIndex] = myCredential;

}

this.reportViewer1.ServerReport.SetDataSourceCredentials( myCredentials );

...............................

}

|||

Hi,

I am facing the same problem.

I used ReportDataSourceInfo then it gives error that DataSource doesnt support it. Error of rsdatasource

So what should be the Connection Methods in Shared DataSource?

Nilesh

|||

Me too there's an error here.

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

any thoughts please?

thanks.

|||

Ishwar,

Thanks for the link. That is awesome. I got it working using the following code.

ServerReport.ReportServerCredentials.NetworkCredentials

= new NetworkCredential(properties.Username, properties.Password, properties.Domain);

Credentials in Reporting Services?

I have created several reports in SQL Server 2005 reporting services and I am viewing those reports in my C# application using a report viewer control. I want to pass the credentials for each report through my applications. I do not want to use any web service.

Is it possible?

Any help will be appreciated!!!

TIA

YOu can use the URL Parameters to pass the username and the password, look in the BOL for more information, the syntax for that is:

prefix:datasourcename=value

as the prefix is dsu (for user) or dsp (for password)

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

Thanks for your reply Jens!!!

But I am using a Report Viewer control in my application. How can I pass the username and password in this case?

|||Hi,
Hope this could help you

System.Net.CredentialCache myCache = new System.Net.CredentialCache();
myCache.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic", new System.Net.NetworkCredential("user", "pass"));

reportViewer.ShowCredentialPrompts = false;
reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache;
reportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
reportViewer.ServerReport.ReportServerUrl ="http://localhost/reportserver";
reportViewer.ServerReport.ReportPath = "/yourReportFolder/" + "yourReportName";
reportViewer.PromptAreaCollapsed = false;
reportViewer.RefreshReport();

|||

I am trying to use the example code provided for a simialr problem but the line (in VB)

reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache

always shows as read only. How do I get round this please?

|||Hi ,
I think your using report viewer web control ofr asp.net. I had same problem.
Its won't work for Microsoft.Reporting.WebForms.ReportViewer.


But i hope this link could help you..

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=373983&SiteID=1

If you found the way please post back here.


Thanks & Best Regards|||

I am attempting to secure my reports with Windows Authentication, but allow users of my application to access it from the www and supply credentials through my app. My app is a .Net 2.0 Windows SmartClient, and I am using the ReportViewer control.

I tried the following suggestion:

reportViewer1.ServerReport.ReportServerUrl = new Uri(_txtServer.Text);

reportViewer1.ServerReport.ReportPath = _listBox.Items[_listBox.SelectedIndex].ToString();

reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;

CredentialCache cc = new CredentialCache();

cc.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic",

new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text));

reportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = cc;

reportViewer1.ShowCredentialPrompts = false;

reportViewer1.RefreshReport();

...But I still get "The request failed with HTTP status 401: Access Denied." I am able to authenticate with the web service directly when requesting a list of available reports like this:

ReportingService rService = new ReportingService();

rService.Credentials

= new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text);

CatalogItem[] catalogItems;

catalogItems = rService.ListChildren("/", true);

Why can I pass windows credentials to the web service directly, but not through the reportViewer call to reporting services? Any help would be very much appreciated!

|||

Hi Glenn,

You might have got the solution for your problem, If not and/or for other developers who might visit this blog, please find the solution at following link. Actually you can get it work by setting ImpersonationUser instead of NetworkCredentials property.

http://blogs.msdn.com/bimusings/archive/2005/11/05/489423.aspx

|||

You can refer following link.

http://msdn2.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials(VS.80).aspx

|||

Hi, you can try this, might help.

I pass the datasource credential through ReportViewer. It is the acutal database login credential instead of a net work credential. So in my application, which login user has nothing to do with Windows

network login user, I am using my application's user id and password to connect to datasource.

By doing this way, I can view a report using diffirent user id/password as long as they exist in the actual database.

It works for me.

private void Form1_Load(object sender, EventArgs e)

{

.............................

Microsoft.Reporting.WinForms.DataSourceCredentials myCredential = new Microsoft.Reporting.WinForms.DataSourceCredentials();

myCredential.UserId = "myuserid";

myCredential.Password = "mypassword";

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

DataSourceCredentials[] myCredentials=null;

if (reportdatasourcecollection.Count > 0)

{

myCredentials = new DataSourceCredentials[reportdatasourcecollection.Count];

}

for (int iIndex = 0; iIndex < reportdatasourcecollection.Count; iIndex++)

{

ReportDataSourceInfo datasourceinfo = reportdatasourcecollection[iIndex];

myCredential.Name = datasourceinfo.Name;

myCredentials[iIndex] = myCredential;

}

this.reportViewer1.ServerReport.SetDataSourceCredentials( myCredentials );

...............................

}

|||

Hi,

I am facing the same problem.

I used ReportDataSourceInfo then it gives error that DataSource doesnt support it. Error of rsdatasource

So what should be the Connection Methods in Shared DataSource?

Nilesh

|||

Me too there's an error here.

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

any thoughts please?

thanks.

|||

Ishwar,

Thanks for the link. That is awesome. I got it working using the following code.

ServerReport.ReportServerCredentials.NetworkCredentials

= new NetworkCredential(properties.Username, properties.Password, properties.Domain);

Credentials in Reporting Services?

I have created several reports in SQL Server 2005 reporting services and I am viewing those reports in my C# application using a report viewer control. I want to pass the credentials for each report through my applications. I do not want to use any web service.

Is it possible?

Any help will be appreciated!!!

TIA

YOu can use the URL Parameters to pass the username and the password, look in the BOL for more information, the syntax for that is:

prefix:datasourcename=value

as the prefix is dsu (for user) or dsp (for password)

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

Thanks for your reply Jens!!!

But I am using a Report Viewer control in my application. How can I pass the username and password in this case?

|||Hi,
Hope this could help you

System.Net.CredentialCache myCache = new System.Net.CredentialCache();
myCache.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic", new System.Net.NetworkCredential("user", "pass"));

reportViewer.ShowCredentialPrompts = false;
reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache;
reportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
reportViewer.ServerReport.ReportServerUrl ="http://localhost/reportserver";
reportViewer.ServerReport.ReportPath = "/yourReportFolder/" + "yourReportName";
reportViewer.PromptAreaCollapsed = false;
reportViewer.RefreshReport();|||

I am trying to use the example code provided for a simialr problem but the line (in VB)

reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache

always shows as read only. How do I get round this please?

|||Hi ,
I think your using report viewer web control ofr asp.net. I had same problem.
Its won't work for Microsoft.Reporting.WebForms.ReportViewer.


But i hope this link could help you..

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=373983&SiteID=1

If you found the way please post back here.


Thanks & Best Regards|||

I am attempting to secure my reports with Windows Authentication, but allow users of my application to access it from the www and supply credentials through my app. My app is a .Net 2.0 Windows SmartClient, and I am using the ReportViewer control.

I tried the following suggestion:

reportViewer1.ServerReport.ReportServerUrl = new Uri(_txtServer.Text);

reportViewer1.ServerReport.ReportPath = _listBox.Items[_listBox.SelectedIndex].ToString();

reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;

CredentialCache cc = new CredentialCache();

cc.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic",

new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text));

reportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = cc;

reportViewer1.ShowCredentialPrompts = false;

reportViewer1.RefreshReport();

...But I still get "The request failed with HTTP status 401: Access Denied." I am able to authenticate with the web service directly when requesting a list of available reports like this:

ReportingService rService = new ReportingService();

rService.Credentials

= new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text);

CatalogItem[] catalogItems;

catalogItems = rService.ListChildren("/", true);

Why can I pass windows credentials to the web service directly, but not through the reportViewer call to reporting services? Any help would be very much appreciated!

|||

Hi Glenn,

You might have got the solution for your problem, If not and/or for other developers who might visit this blog, please find the solution at following link. Actually you can get it work by setting ImpersonationUser instead of NetworkCredentials property.

http://blogs.msdn.com/bimusings/archive/2005/11/05/489423.aspx

|||

You can refer following link.

http://msdn2.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials(VS.80).aspx

|||

Hi, you can try this, might help.

I pass the datasource credential through ReportViewer. It is the acutal database login credential instead of a net work credential. So in my application, which login user has nothing to do with Windows

network login user, I am using my application's user id and password to connect to datasource.

By doing this way, I can view a report using diffirent user id/password as long as they exist in the actual database.

It works for me.

privatevoid Form1_Load(object sender, EventArgs e)

{

.............................

Microsoft.Reporting.WinForms.DataSourceCredentials myCredential = new Microsoft.Reporting.WinForms.DataSourceCredentials();

myCredential.UserId = "myuserid";

myCredential.Password = "mypassword";

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

DataSourceCredentials[] myCredentials=null;

if (reportdatasourcecollection.Count > 0)

{

myCredentials = newDataSourceCredentials[reportdatasourcecollection.Count];

}

for (int iIndex = 0; iIndex < reportdatasourcecollection.Count; iIndex++)

{

ReportDataSourceInfo datasourceinfo = reportdatasourcecollection[iIndex];

myCredential.Name = datasourceinfo.Name;

myCredentials[iIndex] = myCredential;

}

this.reportViewer1.ServerReport.SetDataSourceCredentials( myCredentials );

...............................

}

|||

Hi,

I am facing the same problem.

I used ReportDataSourceInfo then it gives error that DataSource doesnt support it. Error of rsdatasource

So what should be the Connection Methods in Shared DataSource?

Nilesh

|||

Me too there's an error here.

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

any thoughts please?

thanks.

|||

Ishwar,

Thanks for the link. That is awesome. I got it working using the following code.

ServerReport.ReportServerCredentials.NetworkCredentials

= newNetworkCredential(properties.Username, properties.Password, properties.Domain);

Credentials in Reporting Services?

I have created several reports in SQL Server 2005 reporting services and I am viewing those reports in my C# application using a report viewer control. I want to pass the credentials for each report through my applications. I do not want to use any web service.

Is it possible?

Any help will be appreciated!!!

TIA

YOu can use the URL Parameters to pass the username and the password, look in the BOL for more information, the syntax for that is:

prefix:datasourcename=value

as the prefix is dsu (for user) or dsp (for password)

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

Thanks for your reply Jens!!!

But I am using a Report Viewer control in my application. How can I pass the username and password in this case?

|||Hi,
Hope this could help you

System.Net.CredentialCache myCache = new System.Net.CredentialCache();
myCache.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic", new System.Net.NetworkCredential("user", "pass"));

reportViewer.ShowCredentialPrompts = false;
reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache;
reportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
reportViewer.ServerReport.ReportServerUrl ="http://localhost/reportserver";
reportViewer.ServerReport.ReportPath = "/yourReportFolder/" + "yourReportName";
reportViewer.PromptAreaCollapsed = false;
reportViewer.RefreshReport();

|||

I am trying to use the example code provided for a simialr problem but the line (in VB)

reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache

always shows as read only. How do I get round this please?

|||Hi ,
I think your using report viewer web control ofr asp.net. I had same problem.
Its won't work for Microsoft.Reporting.WebForms.ReportViewer.


But i hope this link could help you..

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=373983&SiteID=1

If you found the way please post back here.


Thanks & Best Regards|||

I am attempting to secure my reports with Windows Authentication, but allow users of my application to access it from the www and supply credentials through my app. My app is a .Net 2.0 Windows SmartClient, and I am using the ReportViewer control.

I tried the following suggestion:

reportViewer1.ServerReport.ReportServerUrl = new Uri(_txtServer.Text);

reportViewer1.ServerReport.ReportPath = _listBox.Items[_listBox.SelectedIndex].ToString();

reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;

CredentialCache cc = new CredentialCache();

cc.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic",

new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text));

reportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = cc;

reportViewer1.ShowCredentialPrompts = false;

reportViewer1.RefreshReport();

...But I still get "The request failed with HTTP status 401: Access Denied." I am able to authenticate with the web service directly when requesting a list of available reports like this:

ReportingService rService = new ReportingService();

rService.Credentials

= new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text);

CatalogItem[] catalogItems;

catalogItems = rService.ListChildren("/", true);

Why can I pass windows credentials to the web service directly, but not through the reportViewer call to reporting services? Any help would be very much appreciated!

|||

Hi Glenn,

You might have got the solution for your problem, If not and/or for other developers who might visit this blog, please find the solution at following link. Actually you can get it work by setting ImpersonationUser instead of NetworkCredentials property.

http://blogs.msdn.com/bimusings/archive/2005/11/05/489423.aspx

|||

You can refer following link.

http://msdn2.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials(VS.80).aspx

|||

Hi, you can try this, might help.

I pass the datasource credential through ReportViewer. It is the acutal database login credential instead of a net work credential. So in my application, which login user has nothing to do with Windows

network login user, I am using my application's user id and password to connect to datasource.

By doing this way, I can view a report using diffirent user id/password as long as they exist in the actual database.

It works for me.

private void Form1_Load(object sender, EventArgs e)

{

.............................

Microsoft.Reporting.WinForms.DataSourceCredentials myCredential = new Microsoft.Reporting.WinForms.DataSourceCredentials();

myCredential.UserId = "myuserid";

myCredential.Password = "mypassword";

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

DataSourceCredentials[] myCredentials=null;

if (reportdatasourcecollection.Count > 0)

{

myCredentials = new DataSourceCredentials[reportdatasourcecollection.Count];

}

for (int iIndex = 0; iIndex < reportdatasourcecollection.Count; iIndex++)

{

ReportDataSourceInfo datasourceinfo = reportdatasourcecollection[iIndex];

myCredential.Name = datasourceinfo.Name;

myCredentials[iIndex] = myCredential;

}

this.reportViewer1.ServerReport.SetDataSourceCredentials( myCredentials );

...............................

}

|||

Hi,

I am facing the same problem.

I used ReportDataSourceInfo then it gives error that DataSource doesnt support it. Error of rsdatasource

So what should be the Connection Methods in Shared DataSource?

Nilesh

|||

Me too there's an error here.

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

any thoughts please?

thanks.

|||

Ishwar,

Thanks for the link. That is awesome. I got it working using the following code.

ServerReport.ReportServerCredentials.NetworkCredentials

= new NetworkCredential(properties.Username, properties.Password, properties.Domain);

Credentials in Reporting Services?

I have created several reports in SQL Server 2005 reporting services and I am viewing those reports in my C# application using a report viewer control. I want to pass the credentials for each report through my applications. I do not want to use any web service.

Is it possible?

Any help will be appreciated!!!

TIA

YOu can use the URL Parameters to pass the username and the password, look in the BOL for more information, the syntax for that is:

prefix:datasourcename=value

as the prefix is dsu (for user) or dsp (for password)

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

Thanks for your reply Jens!!!

But I am using a Report Viewer control in my application. How can I pass the username and password in this case?

|||Hi,
Hope this could help you

System.Net.CredentialCache myCache = new System.Net.CredentialCache();
myCache.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic", new System.Net.NetworkCredential("user", "pass"));

reportViewer.ShowCredentialPrompts = false;
reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache;
reportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
reportViewer.ServerReport.ReportServerUrl ="http://localhost/reportserver";
reportViewer.ServerReport.ReportPath = "/yourReportFolder/" + "yourReportName";
reportViewer.PromptAreaCollapsed = false;
reportViewer.RefreshReport();

|||

I am trying to use the example code provided for a simialr problem but the line (in VB)

reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache

always shows as read only. How do I get round this please?

|||Hi ,
I think your using report viewer web control ofr asp.net. I had same problem.
Its won't work for Microsoft.Reporting.WebForms.ReportViewer.


But i hope this link could help you..

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=373983&SiteID=1

If you found the way please post back here.


Thanks & Best Regards|||

I am attempting to secure my reports with Windows Authentication, but allow users of my application to access it from the www and supply credentials through my app. My app is a .Net 2.0 Windows SmartClient, and I am using the ReportViewer control.

I tried the following suggestion:

reportViewer1.ServerReport.ReportServerUrl = new Uri(_txtServer.Text);

reportViewer1.ServerReport.ReportPath = _listBox.Items[_listBox.SelectedIndex].ToString();

reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;

CredentialCache cc = new CredentialCache();

cc.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic",

new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text));

reportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = cc;

reportViewer1.ShowCredentialPrompts = false;

reportViewer1.RefreshReport();

...But I still get "The request failed with HTTP status 401: Access Denied." I am able to authenticate with the web service directly when requesting a list of available reports like this:

ReportingService rService = new ReportingService();

rService.Credentials

= new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text);

CatalogItem[] catalogItems;

catalogItems = rService.ListChildren("/", true);

Why can I pass windows credentials to the web service directly, but not through the reportViewer call to reporting services? Any help would be very much appreciated!

|||

Hi Glenn,

You might have got the solution for your problem, If not and/or for other developers who might visit this blog, please find the solution at following link. Actually you can get it work by setting ImpersonationUser instead of NetworkCredentials property.

http://blogs.msdn.com/bimusings/archive/2005/11/05/489423.aspx

|||

You can refer following link.

http://msdn2.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials(VS.80).aspx

|||

Hi, you can try this, might help.

I pass the datasource credential through ReportViewer. It is the acutal database login credential instead of a net work credential. So in my application, which login user has nothing to do with Windows

network login user, I am using my application's user id and password to connect to datasource.

By doing this way, I can view a report using diffirent user id/password as long as they exist in the actual database.

It works for me.

private void Form1_Load(object sender, EventArgs e)

{

.............................

Microsoft.Reporting.WinForms.DataSourceCredentials myCredential = new Microsoft.Reporting.WinForms.DataSourceCredentials();

myCredential.UserId = "myuserid";

myCredential.Password = "mypassword";

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

DataSourceCredentials[] myCredentials=null;

if (reportdatasourcecollection.Count > 0)

{

myCredentials = new DataSourceCredentials[reportdatasourcecollection.Count];

}

for (int iIndex = 0; iIndex < reportdatasourcecollection.Count; iIndex++)

{

ReportDataSourceInfo datasourceinfo = reportdatasourcecollection[iIndex];

myCredential.Name = datasourceinfo.Name;

myCredentials[iIndex] = myCredential;

}

this.reportViewer1.ServerReport.SetDataSourceCredentials( myCredentials );

...............................

}

|||

Hi,

I am facing the same problem.

I used ReportDataSourceInfo then it gives error that DataSource doesnt support it. Error of rsdatasource

So what should be the Connection Methods in Shared DataSource?

Nilesh

|||

Me too there's an error here.

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

any thoughts please?

thanks.

|||

Ishwar,

Thanks for the link. That is awesome. I got it working using the following code.

ServerReport.ReportServerCredentials.NetworkCredentials

= new NetworkCredential(properties.Username, properties.Password, properties.Domain);

Credentials in Reporting Services?

I have created several reports in SQL Server 2005 reporting services and I am viewing those reports in my C# application using a report viewer control. I want to pass the credentials for each report through my applications. I do not want to use any web service.

Is it possible?

Any help will be appreciated!!!

TIA

YOu can use the URL Parameters to pass the username and the password, look in the BOL for more information, the syntax for that is:

prefix:datasourcename=value

as the prefix is dsu (for user) or dsp (for password)

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

Thanks for your reply Jens!!!

But I am using a Report Viewer control in my application. How can I pass the username and password in this case?

|||Hi,
Hope this could help you

System.Net.CredentialCache myCache = new System.Net.CredentialCache();
myCache.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic", new System.Net.NetworkCredential("user", "pass"));

reportViewer.ShowCredentialPrompts = false;
reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache;
reportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
reportViewer.ServerReport.ReportServerUrl ="http://localhost/reportserver";
reportViewer.ServerReport.ReportPath = "/yourReportFolder/" + "yourReportName";
reportViewer.PromptAreaCollapsed = false;
reportViewer.RefreshReport();|||

I am trying to use the example code provided for a simialr problem but the line (in VB)

reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache

always shows as read only. How do I get round this please?

|||Hi ,
I think your using report viewer web control ofr asp.net. I had same problem.
Its won't work for Microsoft.Reporting.WebForms.ReportViewer.


But i hope this link could help you..

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=373983&SiteID=1

If you found the way please post back here.


Thanks & Best Regards|||

I am attempting to secure my reports with Windows Authentication, but allow users of my application to access it from the www and supply credentials through my app. My app is a .Net 2.0 Windows SmartClient, and I am using the ReportViewer control.

I tried the following suggestion:

reportViewer1.ServerReport.ReportServerUrl = new Uri(_txtServer.Text);

reportViewer1.ServerReport.ReportPath = _listBox.Items[_listBox.SelectedIndex].ToString();

reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;

CredentialCache cc = new CredentialCache();

cc.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic",

new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text));

reportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = cc;

reportViewer1.ShowCredentialPrompts = false;

reportViewer1.RefreshReport();

...But I still get "The request failed with HTTP status 401: Access Denied." I am able to authenticate with the web service directly when requesting a list of available reports like this:

ReportingService rService = new ReportingService();

rService.Credentials

= new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text);

CatalogItem[] catalogItems;

catalogItems = rService.ListChildren("/", true);

Why can I pass windows credentials to the web service directly, but not through the reportViewer call to reporting services? Any help would be very much appreciated!

|||

Hi Glenn,

You might have got the solution for your problem, If not and/or for other developers who might visit this blog, please find the solution at following link. Actually you can get it work by setting ImpersonationUser instead of NetworkCredentials property.

http://blogs.msdn.com/bimusings/archive/2005/11/05/489423.aspx

|||

You can refer following link.

http://msdn2.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials(VS.80).aspx

|||

Hi, you can try this, might help.

I pass the datasource credential through ReportViewer. It is the acutal database login credential instead of a net work credential. So in my application, which login user has nothing to do with Windows

network login user, I am using my application's user id and password to connect to datasource.

By doing this way, I can view a report using diffirent user id/password as long as they exist in the actual database.

It works for me.

privatevoid Form1_Load(object sender, EventArgs e)

{

.............................

Microsoft.Reporting.WinForms.DataSourceCredentials myCredential = new Microsoft.Reporting.WinForms.DataSourceCredentials();

myCredential.UserId = "myuserid";

myCredential.Password = "mypassword";

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

DataSourceCredentials[] myCredentials=null;

if (reportdatasourcecollection.Count > 0)

{

myCredentials = newDataSourceCredentials[reportdatasourcecollection.Count];

}

for (int iIndex = 0; iIndex < reportdatasourcecollection.Count; iIndex++)

{

ReportDataSourceInfo datasourceinfo = reportdatasourcecollection[iIndex];

myCredential.Name = datasourceinfo.Name;

myCredentials[iIndex] = myCredential;

}

this.reportViewer1.ServerReport.SetDataSourceCredentials( myCredentials );

...............................

}

|||

Hi,

I am facing the same problem.

I used ReportDataSourceInfo then it gives error that DataSource doesnt support it. Error of rsdatasource

So what should be the Connection Methods in Shared DataSource?

Nilesh

|||

Me too there's an error here.

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

any thoughts please?

thanks.

|||

Ishwar,

Thanks for the link. That is awesome. I got it working using the following code.

ServerReport.ReportServerCredentials.NetworkCredentials

= newNetworkCredential(properties.Username, properties.Password, properties.Domain);

Credentials in Reporting Services?

I have created several reports in SQL Server 2005 reporting services and I am viewing those reports in my C# application using a report viewer control. I want to pass the credentials for each report through my applications. I do not want to use any web service.

Is it possible?

Any help will be appreciated!!!

TIA

YOu can use the URL Parameters to pass the username and the password, look in the BOL for more information, the syntax for that is:

prefix:datasourcename=value

as the prefix is dsu (for user) or dsp (for password)

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

Thanks for your reply Jens!!!

But I am using a Report Viewer control in my application. How can I pass the username and password in this case?

|||Hi,
Hope this could help you

System.Net.CredentialCache myCache = new System.Net.CredentialCache();
myCache.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic", new System.Net.NetworkCredential("user", "pass"));

reportViewer.ShowCredentialPrompts = false;
reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache;
reportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
reportViewer.ServerReport.ReportServerUrl ="http://localhost/reportserver";
reportViewer.ServerReport.ReportPath = "/yourReportFolder/" + "yourReportName";
reportViewer.PromptAreaCollapsed = false;
reportViewer.RefreshReport();

|||

I am trying to use the example code provided for a simialr problem but the line (in VB)

reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache

always shows as read only. How do I get round this please?

|||Hi ,
I think your using report viewer web control ofr asp.net. I had same problem.
Its won't work for Microsoft.Reporting.WebForms.ReportViewer.


But i hope this link could help you..

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=373983&SiteID=1

If you found the way please post back here.


Thanks & Best Regards|||

I am attempting to secure my reports with Windows Authentication, but allow users of my application to access it from the www and supply credentials through my app. My app is a .Net 2.0 Windows SmartClient, and I am using the ReportViewer control.

I tried the following suggestion:

reportViewer1.ServerReport.ReportServerUrl = new Uri(_txtServer.Text);

reportViewer1.ServerReport.ReportPath = _listBox.Items[_listBox.SelectedIndex].ToString();

reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;

CredentialCache cc = new CredentialCache();

cc.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic",

new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text));

reportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = cc;

reportViewer1.ShowCredentialPrompts = false;

reportViewer1.RefreshReport();

...But I still get "The request failed with HTTP status 401: Access Denied." I am able to authenticate with the web service directly when requesting a list of available reports like this:

ReportingService rService = new ReportingService();

rService.Credentials

= new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text);

CatalogItem[] catalogItems;

catalogItems = rService.ListChildren("/", true);

Why can I pass windows credentials to the web service directly, but not through the reportViewer call to reporting services? Any help would be very much appreciated!

|||

Hi Glenn,

You might have got the solution for your problem, If not and/or for other developers who might visit this blog, please find the solution at following link. Actually you can get it work by setting ImpersonationUser instead of NetworkCredentials property.

http://blogs.msdn.com/bimusings/archive/2005/11/05/489423.aspx

|||

You can refer following link.

http://msdn2.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials(VS.80).aspx

|||

Hi, you can try this, might help.

I pass the datasource credential through ReportViewer. It is the acutal database login credential instead of a net work credential. So in my application, which login user has nothing to do with Windows

network login user, I am using my application's user id and password to connect to datasource.

By doing this way, I can view a report using diffirent user id/password as long as they exist in the actual database.

It works for me.

private void Form1_Load(object sender, EventArgs e)

{

.............................

Microsoft.Reporting.WinForms.DataSourceCredentials myCredential = new Microsoft.Reporting.WinForms.DataSourceCredentials();

myCredential.UserId = "myuserid";

myCredential.Password = "mypassword";

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

DataSourceCredentials[] myCredentials=null;

if (reportdatasourcecollection.Count > 0)

{

myCredentials = new DataSourceCredentials[reportdatasourcecollection.Count];

}

for (int iIndex = 0; iIndex < reportdatasourcecollection.Count; iIndex++)

{

ReportDataSourceInfo datasourceinfo = reportdatasourcecollection[iIndex];

myCredential.Name = datasourceinfo.Name;

myCredentials[iIndex] = myCredential;

}

this.reportViewer1.ServerReport.SetDataSourceCredentials( myCredentials );

...............................

}

|||

Hi,

I am facing the same problem.

I used ReportDataSourceInfo then it gives error that DataSource doesnt support it. Error of rsdatasource

So what should be the Connection Methods in Shared DataSource?

Nilesh

|||

Me too there's an error here.

ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources();

any thoughts please?

thanks.

|||

Ishwar,

Thanks for the link. That is awesome. I got it working using the following code.

ServerReport.ReportServerCredentials.NetworkCredentials

= new NetworkCredential(properties.Username, properties.Password, properties.Domain);

Tuesday, March 27, 2012

Creating XML output...unusual/impossible format?

Hi all,

I'm Trying to replicate the creation of an "xml" file that is currently created using a C++ application. I want to take that application out of the picture, but need to create the same format XML file because a step later in the production process uses this file, and I cannot change it.

The output format I am looking for is:<?xml version="1.0" encoding="utf-8"?>
<FUNDS>
<AMRGX>
<NAME>AMERICAN GROWTH D</NAME>
</AMRGX>
<AHERX>
<NAME>AMERICAN HERITAGE FUND</NAME>
</AHERX>
<AMRVX>
<NAME>AMERICAN INVESTORS GROWTH FUND</NAME>
</AMRVX>
.
.
.
</FUNDS>The problem I am having is that I cannot seem to get the level/node of the fund symbol (AMRGX, AHERX, and AMRVX in the example above) as it needs to be. I think this must be some non-standard use of XML, since the tag is really the data itself (?)

The closest I have been able to get so far is:
<FUNDS>
<SYMBOL>AMRGX</SYMBOL>
<NAME>AMERICAN GROWTH D</NAME>
</FUNDS>
<FUNDS>
<SYMBOL>AHERX</SYMBOL>
<NAME>AMERICAN HERITAGE FUND</NAME>
</FUNDS>
.
.
.As you can see (hopefully) I am able to get the data I need but cannot get:
(1) the FUNDS tag(s) to be the very highest level/root.
nor (2) the SYMBOL part (tag label?) to be the actual variable stock fund.

Am I 'splaining this well enough? I don't necessarily need all the code, since I know I haven't given enough info to help with that, but my basic question is - - Is it possible to get a variable TAG based on the table DATA?

I want my SYMBOL tag to be the actual SYMBOL for the stock fund.

Confused? Not as much as I am *LOL* I am new to the use of all but XML EXPLICIT use, so any help would be appreciated - at least regarding my two formatting questions.

Yes, I have (and am still) searching around BOL for my answers, but so I have found nothing that helps me out. Meanwhile, suggestions are welcome!

Thanks!You cannot achieve this with a single SELECT statement because you can have only one column name for the entire result set.(you stated this already). If you need to have the column value as a tag then a stored procedure is the way to go where you can generate your own XML TAGs.
Hi all,

I'm Trying to replicate the creation of an "xml" file that is currently created using a C++ application. I want to take that application out of the picture, but need to create the same format XML file because a step later in the production process uses this file, and I cannot change it.

The output format I am looking for is:<?xml version="1.0" encoding="utf-8"?>
<FUNDS>
<AMRGX>
<NAME>AMERICAN GROWTH D</NAME>
</AMRGX>
<AHERX>
<NAME>AMERICAN HERITAGE FUND</NAME>
</AHERX>
<AMRVX>
<NAME>AMERICAN INVESTORS GROWTH FUND</NAME>
</AMRVX>
.
.
.
</FUNDS>The problem I am having is that I cannot seem to get the level/node of the fund symbol (AMRGX, AHERX, and AMRVX in the example above) as it needs to be. I think this must be some non-standard use of XML, since the tag is really the data itself (?)

The closest I have been able to get so far is:
<FUNDS>
<SYMBOL>AMRGX</SYMBOL>
<NAME>AMERICAN GROWTH D</NAME>
</FUNDS>
<FUNDS>
<SYMBOL>AHERX</SYMBOL>
<NAME>AMERICAN HERITAGE FUND</NAME>
</FUNDS>
.
.
.As you can see (hopefully) I am able to get the data I need but cannot get:
(1) the FUNDS tag(s) to be the very highest level/root.
nor (2) the SYMBOL part (tag label?) to be the actual variable stock fund.

Am I 'splaining this well enough? I don't necessarily need all the code, since I know I haven't given enough info to help with that, but my basic question is - - Is it possible to get a variable TAG based on the table DATA?

I want my SYMBOL tag to be the actual SYMBOL for the stock fund.

Confused? Not as much as I am *LOL* I am new to the use of all but XML EXPLICIT use, so any help would be appreciated - at least regarding my two formatting questions.

Yes, I have (and am still) searching around BOL for my answers, but so I have found nothing that helps me out. Meanwhile, suggestions are welcome!

Thanks!|||Thanks for the reply.

I was afraid of that. The previous version of the product used a C++ program to generate the XML (or pseudo-XML) output. I was hoping it was just because the developer didn't know how to use the XML extraction stuff in SQL Server. *sigh*

Oh well, I guess I get to gain some C# practice, as the C++ application has the source of the data "hard coded" in the logic, and we need to use a predefined, "standard" linked server reference (aka "alias").|||"Can't be Done"?

The three words I tell developers to never let me hear, otherwise I bring out the baseball bat

Dude, you know the drill

DDL, DML, I gues we got the expected results already...|||Never mind...but I'm only guessing...

USE Northwind
GO

CREATE TABLE myTable99(FundSymbol char(5), FundName varchar(255))
GO

INSERT INTO myTable99(FundSymbol, FundName)
SELECT 'AMRGX', 'AMERICAN GROWTH D' UNION ALL
SELECT 'AHERX', 'AHERX HERITAGE FUND' UNION ALL
SELECT 'AMRVX', 'AMERICAN INVESTORS GROWTH FUND'

SELECT XML_Output
FROM (
SELECT '<?xml version="1.0" encoding="utf-8"?>' AS XML_Output, 1 AS XML_Group, Null AS FundSymbol
UNION ALL
SELECT '<FUNDS>'AS XML_Output, 2 AS XML_Group, Null AS FundSymbol
UNION ALL
SELECT REPLICATE(' ',20)+'<'+FundSymbol+'>'+CHAR(13)+CHAR(10)
+ REPLICATE(' ',40)+'<NAME>'+FundName+'</NAME>'+CHAR(13)+CHAR(10)
+ REPLICATE(' ',20)+'</'+FundSymbol+'>'+CHAR(13)+CHAR(10)AS XML_Output
, 3 AS XML_Group, FundSymbol
FROM myTable99
UNION ALL
SELECT '<FUNDS>'AS XML_Output, 4 AS XML_Group, Null AS FundSymbol
) AS XXX
ORDER BY XML_Group, FundSymbol
GO

DROP TABLE myTable99
GO|||*sigh* What can I say? Every day you guys amaze me more-n-more :)

That's EXACLY what I was a-lookin for! I appreciate you doing my homework for me *hanging head* I tend to forget the usefullness of UNION, and have yet to use "REPLICATE", so now I need to go look THAT one up in BOL so that I can once again expand my horizons just a little more.

Funny (to me, anyway) that because every other application in our world here that creates XML output uses the FOR XML directive to create the output, that I get tunnel vision and just can't seem to see the easy answer lies in "standard" SQL. I guess kinda like my kids, who can't seem to get their heads around the ideas that (a) you can make your own ice cream, (b)clothes can come from a sewing machine instead of a store, (c) there's a way to change your oil without going to Jiffy Lube, and myriad other such examples of "OMG, you mean you can do that the old-fashioned way?".

But I digress...Thanks once again, Brett, for taking the time and effort to plainly show how I can get around yet another stumbling block.

It's too bad though, that since it can't be done, I will have to disregard your fantasy code and open my C# book. ;)

Thanks again!|||A mere trifle...

I was interested, because of a discussion I had with a Java developer.

If I could deliver the content in a manner like you are looking for, then the development life cycle for java gets cut in half.

I'm just exploring this now, but I was leaning on having metadata stored in the database, where I could configure all of the results via table.

Each element would have it's own properties stored.

So if the don't like the text to be black, I can make it red, on the fly. No application release headaches.

I was going to extend that and see if I could also incorporate the style sheets in the database as well..

FOR XML...what a bunch of crap

Creating VirtualDeviceSet for Remote SQL Server 2005 failed.

Hi, all!

I am writing the VDI application to allow backup/restore MS SQL Server 2005. I would want to backup/restore remote servers as well as local. I have local instance of MS SQL 2005 and remote. Local instance has MSSQL2005_ZORG instance name, remote uses default (so it supposed to be MSSQLSERVER).

While connection to those server via SQL Server Management studio i see local server as "ZORG\MSSQL2005_ZORG" and remote as "VM2000SRVZ2".

When i try to create VIrtualDeviceSet via CreateEx i pass "MSSQL2005_ZORG" as lpInstanceName parameter and all works fine. But I could't create same device set for remote 'MSSQLSERVER' instance. I passed any combination for that, such as "VM2000SRVZ2\MSSQLSERVER", "MSSQLSERVER", "VM2000SRVZ2", "\\VM2000SRVZ2\MSSQLSERVER" and so on. No luck always get VD_E_INSTANCE_NAME (0x80770007).

Any idea?

--Thanks

Hi,
As per the Microsoft Virtual Backup specifications, VDI can be used only on local machines.You can download the specifications from

http://www.microsoft.com/downloads/details.aspx?familyid=416f8a51-65a3-4e8e-a4c8-adfe15e850fc&displaylang=en

If u have used VDI for some time, i need ur help.Relpy if you can

Creating VirtualDeviceSet for Remote SQL Server 2005 failed.

Hi, all!

I am writing the VDI application to allow backup/restore MS SQL Server 2005. I would want to backup/restore remote servers as well as local. I have local instance of MS SQL 2005 and remote. Local instance has MSSQL2005_ZORG instance name, remote uses default (so it supposed to be MSSQLSERVER).

While connection to those server via SQL Server Management studio i see local server as "ZORG\MSSQL2005_ZORG" and remote as "VM2000SRVZ2".

When i try to create VIrtualDeviceSet via CreateEx i pass "MSSQL2005_ZORG" as lpInstanceName parameter and all works fine. But I could't create same device set for remote 'MSSQLSERVER' instance. I passed any combination for that, such as "VM2000SRVZ2\MSSQLSERVER", "MSSQLSERVER", "VM2000SRVZ2", "\\VM2000SRVZ2\MSSQLSERVER" and so on. No luck always get VD_E_INSTANCE_NAME (0x80770007).

Any idea?

--Thanks

Hi,
As per the Microsoft Virtual Backup specifications, VDI can be used only on local machines.You can download the specifications from

http://www.microsoft.com/downloads/details.aspx?familyid=416f8a51-65a3-4e8e-a4c8-adfe15e850fc&displaylang=en

If u have used VDI for some time, i need ur help.Relpy if you can

Sunday, March 25, 2012

Creating user from application

I'm trying to create a user from a powerbuilder application through powerscript.
I'm trying to create first the login using sp_addlogin
but I'm getting the following error
[microsoft][odbc for sql server]the procedure sp_addlogin cannot be executed in transaction.

Plz does someone know what should I do?CREATE Procedure CreareUser (@.UserName varchar(30), @.UserPass varchar(30), @.DBName varchar(30),@.DreptScriere bit)

as

if exists (select * from master.dbo.syslogins where loginname=@.UserName)

exec sp_dropuser @.UserName
exec sp_droplogin @.UserName


if not exists (select * from master.dbo.syslogins where loginname = @.UserName)
BEGIN

EXEC sp_addlogin @.UserName, @.UserPass, @.DBName
EXEC sp_defaultdb @.UserName,@.DBName

if @.DreptScriere=0
BEGIN
EXEC sp_adduser @.UserName,@.UserName,
'db_denydatawriter'
EXEC sp_changegroup 'db_owner' ,@.UserName
EXEC sp_addrolemember 'db_denydatawriter' ,@.UserName
END
else
BEGIN
EXEC sp_adduser @.UserName,@.UserName,'db_owner'
END

EXEC sp_grantdbaccess @.UserName

END

Thursday, March 22, 2012

Creating temporary table using a template table dynamically

I'm having an application for users to extract data from sql 2K. Problem is that I need to split the huge amount of data into few pages on the application screen.

Since my order by clause could be dynamic, which is a big problem, the solution I can think of is to populate a temporary table ( within a stored proc ) and assign a column within the temporary table with a running number.

This stored proc would accept among them, an argument, which is the table name of a base table.

However, I would like to create this stored proc in such a way that I could create a temporary table based on given based table name, complete with the field sizes and types. On top of that, would like to add a new column to this temp table to store a running number key.

Opinions appreciated. :)Refer to this linkSQL Performance (http://www.sql-server-performance.com/rd_temp_tables.asp) for information.

Creating tables within my application.

I am having the following problem and any help would be GREATLY
appreciated:

In an application I am developing, at some points we create a new
table. When I create this table on another users box, I can not access
it from my box. In sql server I am dbo, but the table created by my
application when run on a different box has an owner of : "FC\xxxx". I
have sent permissions on this thing to public, but I am still getting
an error when I try to query this thing from my application. And I can
not get query analyzer to recognize this thing. I can see it in
Enterprise manager. I would think there is a way to handle this sort
of thing. If anyone out there has done anything like this I would be
much obliged for any ideas. Thanks.
Sincerely,
Ed Hawkes
olaamigoquepasa@.nospamplease-hotmail.comEd Hawkes (olaamigoquepasa@.hotmail.com) writes:
> I am having the following problem and any help would be GREATLY
> appreciated:
> In an application I am developing, at some points we create a new
> table. When I create this table on another users box, I can not access
> it from my box. In sql server I am dbo, but the table created by my
> application when run on a different box has an owner of : "FC\xxxx". I
> have sent permissions on this thing to public, but I am still getting
> an error when I try to query this thing from my application. And I can
> not get query analyzer to recognize this thing. I can see it in
> Enterprise manager. I would think there is a way to handle this sort
> of thing. If anyone out there has done anything like this I would be
> much obliged for any ideas. Thanks.

If you are logged into SQL Server as FC\ABC and this user is not dbo,
the the tables will be owned by FC\ABC. For other users to refer to
this table, they would have to say

SELECT * FROM [FC\ABC].tbl

That is they must specify the owner. If this is not desireable, you would
have to say:

CREATE TABLE dbo.tbl (...)

and the table will be owned by dbo. This may require more privledges
than you have granted today.

Generally, having users creating tables is nothing you would normally
do. Chances are, that there is some basic flaw in your design. But since
I don't know anything about your system, I may be completely wrong on
that point.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Monday, March 19, 2012

Creating SQL Server 2005 Mobile Edition On Desktop

Hello Everybody

I want to create SQL server 2005 mobile database on desktop programmatically with some inital data for my application and load it into device. We can create database only in VS2005 server explorer or SQL server 2005 application.

Anybody having this solution for this prob.

Regards

Chikuu

Have you had any chance to look at:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=16369&SiteID=1

Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

|||

Hello

My problem is solved using this link. I had copied those dll's into bin folder it woks fine on any windows desktop running VS2005.

Thanks

Chikuu

|||

Glad that I could help you.

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Mobile, Microsoft Corporation

|||

Hello

We are trying to install sdf creation code on windows server 2000, but it is giving message that ' sql mobile usage is restricted on this platform to use sql mobile you need dot net 2005,sql server 2005 or Tablet PC sku' i got this message eralier when i am installing it on windows server 2003 that time i had installed sql mobile sdk and then this message is not shown. Is there another solution for windows sever 2000, specifically in destributing these application.

Thanks

Chekku

|||

Chekku,

You really do need to install VS2005 or SS2005 on your Windows 2000 server to use SQL Mobile. It's part of the licensing.

-Darren

|||Hopefully the problems will be sorted with SQL Everywhere. You CAN get around the problem and still stay within Microsoft licencing terms without having to have Visual Studio, etc:

1) Download SQL Express from Microsoft (free download)

2) Extract to a folder using the /x option

3) In the 'Setup' folder there is a file called 'SqlSupport.msi'. Install this on your target PC (only a 9MB file so no big deal).

4) Also on your target PC, deploy the following files along with your app:

sqlceca30.dll

The SQL Server Mobile Client Agent. Required for applications that connect to SQL Server by using replication or remote data access.

sqlcecompact30.dll

Provides the compact database functionality. Required if your application will use compaction.

sqlceer30[language].dll

Contains error strings for SQL Server Mobile-generated errors. Required for all SQL Server Mobile applications.

sqlceme30.dll

Contains code required by the System.Data.SqlServerCe.dll file. Required for all SQL Server Mobile applications.

sqlceoledb30.dll

Provides OLE DB connectivity to SQL Server Mobile databases. Required only if your application uses OLE DB to connect to the SQL Server Mobile database.

sqlceqp30.dll

The SQL Server Mobile Query Processor. Required for all SQL Server Mobile applications.

sqlcese30.dll

The SQL Server Mobile Engine. Required for all SQL Server Mobile applications.

System.Data.SqlServerCe.dll

Seems bizarre how a free download keeps the licence happy !

Creating SQL Server 2005 Mobile Edition On Desktop

Hello Everybody

I want to create SQL server 2005 mobile database on desktop programmatically with some inital data for my application and load it into device. We can create database only in VS2005 server explorer or SQL server 2005 application.

Anybody having this solution for this prob.

Regards

Chikuu

Have you had any chance to look at:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=16369&SiteID=1

Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

|||

Hello

My problem is solved using this link. I had copied those dll's into bin folder it woks fine on any windows desktop running VS2005.

Thanks

Chikuu

|||

Glad that I could help you.

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Mobile, Microsoft Corporation

|||

Hello

We are trying to install sdf creation code on windows server 2000, but it is giving message that ' sql mobile usage is restricted on this platform to use sql mobile you need dot net 2005,sql server 2005 or Tablet PC sku' i got this message eralier when i am installing it on windows server 2003 that time i had installed sql mobile sdk and then this message is not shown. Is there another solution for windows sever 2000, specifically in destributing these application.

Thanks

Chekku

|||

Chekku,

You really do need to install VS2005 or SS2005 on your Windows 2000 server to use SQL Mobile. It's part of the licensing.

-Darren

|||Hopefully the problems will be sorted with SQL Everywhere. You CAN get around the problem and still stay within Microsoft licencing terms without having to have Visual Studio, etc:

1) Download SQL Express from Microsoft (free download)

2) Extract to a folder using the /x option

3) In the 'Setup' folder there is a file called 'SqlSupport.msi'. Install this on your target PC (only a 9MB file so no big deal).

4) Also on your target PC, deploy the following files along with your app:

sqlceca30.dll

The SQL Server Mobile Client Agent. Required for applications that connect to SQL Server by using replication or remote data access.

sqlcecompact30.dll

Provides the compact database functionality. Required if your application will use compaction.

sqlceer30[language].dll

Contains error strings for SQL Server Mobile-generated errors. Required for all SQL Server Mobile applications.

sqlceme30.dll

Contains code required by the System.Data.SqlServerCe.dll file. Required for all SQL Server Mobile applications.

sqlceoledb30.dll

Provides OLE DB connectivity to SQL Server Mobile databases. Required only if your application uses OLE DB to connect to the SQL Server Mobile database.

sqlceqp30.dll

The SQL Server Mobile Query Processor. Required for all SQL Server Mobile applications.

sqlcese30.dll

The SQL Server Mobile Engine. Required for all SQL Server Mobile applications.

System.Data.SqlServerCe.dll

Seems bizarre how a free download keeps the licence happy !

Creating SQL Server 2005 Mobile Edition On Desktop

Hello Everybody

I want to create SQL server 2005 mobile database on desktop programmatically with some inital data for my application and load it into device. We can create database only in VS2005 server explorer or SQL server 2005 application.

Anybody having this solution for this prob.

Regards

Chikuu

Have you had any chance to look at:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=16369&SiteID=1

Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

|||

Hello

My problem is solved using this link. I had copied those dll's into bin folder it woks fine on any windows desktop running VS2005.

Thanks

Chikuu

|||

Glad that I could help you.

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Mobile, Microsoft Corporation

|||

Hello

We are trying to install sdf creation code on windows server 2000, but it is giving message that ' sql mobile usage is restricted on this platform to use sql mobile you need dot net 2005,sql server 2005 or Tablet PC sku' i got this message eralier when i am installing it on windows server 2003 that time i had installed sql mobile sdk and then this message is not shown. Is there another solution for windows sever 2000, specifically in destributing these application.

Thanks

Chekku

|||

Chekku,

You really do need to install VS2005 or SS2005 on your Windows 2000 server to use SQL Mobile. It's part of the licensing.

-Darren

|||Hopefully the problems will be sorted with SQL Everywhere. You CAN get around the problem and still stay within Microsoft licencing terms without having to have Visual Studio, etc:

1) Download SQL Express from Microsoft (free download)

2) Extract to a folder using the /x option

3) In the 'Setup' folder there is a file called 'SqlSupport.msi'. Install this on your target PC (only a 9MB file so no big deal).

4) Also on your target PC, deploy the following files along with your app:

sqlceca30.dll

The SQL Server Mobile Client Agent. Required for applications that connect to SQL Server by using replication or remote data access.

sqlcecompact30.dll

Provides the compact database functionality. Required if your application will use compaction.

sqlceer30[language].dll

Contains error strings for SQL Server Mobile-generated errors. Required for all SQL Server Mobile applications.

sqlceme30.dll

Contains code required by the System.Data.SqlServerCe.dll file. Required for all SQL Server Mobile applications.

sqlceoledb30.dll

Provides OLE DB connectivity to SQL Server Mobile databases. Required only if your application uses OLE DB to connect to the SQL Server Mobile database.

sqlceqp30.dll

The SQL Server Mobile Query Processor. Required for all SQL Server Mobile applications.

sqlcese30.dll

The SQL Server Mobile Engine. Required for all SQL Server Mobile applications.

System.Data.SqlServerCe.dll

Seems bizarre how a free download keeps the licence happy !

Creating SQL Server 2005 Mobile Edition On Desktop

Hello Everybody

I want to create SQL server 2005 mobile database on desktop programmatically with some inital data for my application and load it into device. We can create database only in VS2005 server explorer or SQL server 2005 application.

Anybody having this solution for this prob.

Regards

Chikuu

Have you had any chance to look at:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=16369&SiteID=1

Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

|||

Hello

My problem is solved using this link. I had copied those dll's into bin folder it woks fine on any windows desktop running VS2005.

Thanks

Chikuu

|||

Glad that I could help you.

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Mobile, Microsoft Corporation

|||

Hello

We are trying to install sdf creation code on windows server 2000, but it is giving message that ' sql mobile usage is restricted on this platform to use sql mobile you need dot net 2005,sql server 2005 or Tablet PC sku' i got this message eralier when i am installing it on windows server 2003 that time i had installed sql mobile sdk and then this message is not shown. Is there another solution for windows sever 2000, specifically in destributing these application.

Thanks

Chekku

|||

Chekku,

You really do need to install VS2005 or SS2005 on your Windows 2000 server to use SQL Mobile. It's part of the licensing.

-Darren

|||Hopefully the problems will be sorted with SQL Everywhere. You CAN get around the problem and still stay within Microsoft licencing terms without having to have Visual Studio, etc:

1) Download SQL Express from Microsoft (free download)

2) Extract to a folder using the /x option

3) In the 'Setup' folder there is a file called 'SqlSupport.msi'. Install this on your target PC (only a 9MB file so no big deal).

4) Also on your target PC, deploy the following files along with your app:

sqlceca30.dll

The SQL Server Mobile Client Agent. Required for applications that connect to SQL Server by using replication or remote data access.

sqlcecompact30.dll

Provides the compact database functionality. Required if your application will use compaction.

sqlceer30[language].dll

Contains error strings for SQL Server Mobile-generated errors. Required for all SQL Server Mobile applications.

sqlceme30.dll

Contains code required by the System.Data.SqlServerCe.dll file. Required for all SQL Server Mobile applications.

sqlceoledb30.dll

Provides OLE DB connectivity to SQL Server Mobile databases. Required only if your application uses OLE DB to connect to the SQL Server Mobile database.

sqlceqp30.dll

The SQL Server Mobile Query Processor. Required for all SQL Server Mobile applications.

sqlcese30.dll

The SQL Server Mobile Engine. Required for all SQL Server Mobile applications.

System.Data.SqlServerCe.dll

Seems bizarre how a free download keeps the licence happy !

Sunday, March 11, 2012

creating server alias without Client Tools installed?

Hi All: What is the MDAC application that allows you to create server
aliases if you don't have Client Tools installed?
sorry...I was looking for "cliconfg.exe"
"geek-y-guy" <noone@.nowhere.com> wrote in message
news:eQFUPOCHGHA.1628@.TK2MSFTNGP12.phx.gbl...
> Hi All: What is the MDAC application that allows you to create server
> aliases if you don't have Client Tools installed?
>