Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Friday, March 30, 2012

How do I add ASPNET user to SQLExpress DB?

I am going though the ASP.NET QuickStart tutorials. One of the lessons is to add a datagrid. I am able to do that with VWD and am able to connect to the database in VWD. However when I try to execute the application I get a "Login failure" message because the user pcName/ASPNET cannot login.

How do I add the ASPNET user to the SQLExpress database? There don't seem to be any administration tools that were installed with SQL Server Express 2005.

Thanks in advance for the help!

There are two permissions to SQL Server the Server permissions under security in Management in Management Studio and the new security section within the database. The management tools are a separate download. Hope this helps.

http://msdn.microsoft.com/vstudio/express/sql/compare/default.aspx

|||Thank you so much! It worked!|||

the link you posted is taking me to sqlexpress home page. And I don't see anything that is related to our discussion. Could you help little more and send me what I need to do in order to add aspnet user to sqlexpress??

thanks

Cemal

Wednesday, March 28, 2012

How do I add a .DLL to my SSIS script task?

Hi,

I have some code written in .NET sitting in a .DLL. I would like to call this code from a script task block of code... but how do I add the .DLL to my project? If I go to References->Add References, there is no "Browse" button like there is in "normal" VS.NET. How can I add this .DLL? So far I have had to copy and paste the code from the .DLL into my project, but this is ugly!!

Thanks for any help.

Hi,

Refer this link: http://sqljunkies.com/WebLog/knight_reign/archive/2005/07/07/16018.aspx

|||

Thanks for your reply. However, I am now having problems trying to just add a .DLL to the GAC! I am following thse steps

1) goto .NET command line and type "sn -k SomeStrongName.snk" (it tells me the key was created)

2) add the this to the top of my code after imports, "<Assembly: AssemblyKeyFile("SomeStrongName.snk")> "

When I try to compile the .dll, it gives this error: "Error creating assembly manifest: Error reading key file 'SomeStrongName.snk' -- The system cannot find the file specified. "

Do you have any clue why this is happening? Is there somehwere i should move this .snk file to? Or do I have to change a path setting or something?

Any help is greatly appreciated!!!


|||I'd say the path is incorrect to the key. From memory something like ..\..\Keyfilename.snk worked best in VS 2003, but in VS 2005 just set the key in the Project Properties, Signing page, it saves all the hassle of specifying the AssembkykeyFile attribute by hand, it does it for you under the covers.

How do i access the SQL server from a website.

How do I access the SQL server from a website, using my Machine Account, not the ASP.NET account?

thanks.

.intrino.On www.connectionstrings.com you can see all of the possible types of connection strings.

When you say "my machine account" do you mean a SQL Server Login, or using impersonation and your Windows account. If you want to use your Windows account, are both machines in the same Windows domain, and do you have a domain account?|||I want to use my account that is like so:

myDomain/Intrino

Instead the site connects as myDomain/ASPNET to the SQL server...and the connection string that i have set up is the SSPI and my IIS is setup as Windows Authentication and it setup as well in the web.config to use the Windows login.

I would like to connect as myDomain/Intrino...how do I transfer the login into the connection string?|||Anyone have any information on this?...|||You need to have ASP.NET run under a different account (your account).

In the Web.Config:

<identity impersonate="true" userName="domain\Jane" password="pass"/>|||So no way to the Web.Config dynammically to impersonate the user logged on?

Thanks for the answer.

.intrino.sql

Monday, March 26, 2012

How disable Named Pipes in SQL Server 2000 from VB.NET

Hello,

I have a big problem with SQL Server 2000 and Visual Basic .Net. I wont disable named Pipes from code write in Visual Basic (.Net). How make this ?

This problem is very important for me.

Help me! Please!!!

Try SMO/DMO forum:
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=88&SiteID=1
(this forum is about SSIS, not sure if anyone knows the answer)

Wednesday, March 21, 2012

How choose net lib on client side?

I have SQL Server 7 and it has in the network config utility TCP, Named
Pipes and Multiprotocol. I want to use TCP on my clients, the only problem
is I don't know how to set them up to use this as opposed to named pipes. I
do not want to authenticate at the OS level so I'm trying to get it to use
plain old TCP. By default, all of them appear to be using named pipes. Is
there some way I can confirm or change this theory?
Thanks,
Ben
You can manage this using the Client Network Utillity on the client machine.
From the server, you can tell what netlib a client is connecting on by
looking at the net_library column in master..sysprocesses.
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Becker" <ben@.benbecker.net> wrote in message
news:OAtKhaKdEHA.3988@.tk2msftngp13.phx.gbl...
> I have SQL Server 7 and it has in the network config utility TCP, Named
> Pipes and Multiprotocol. I want to use TCP on my clients, the only
problem
> is I don't know how to set them up to use this as opposed to named pipes.
I
> do not want to authenticate at the OS level so I'm trying to get it to use
> plain old TCP. By default, all of them appear to be using named pipes.
Is
> there some way I can confirm or change this theory?
> Thanks,
> Ben
>
|||Interesting, so if I don't have the sql client loaded on a machine, what net
library will it use by default? E.g. I have a fresh install of win 2k with
an app that connects to SQL Server, I haven't loaded a client on it but the
app works just fine and it is using named pipes. I want it to use tcp/ip,
do i have to load the client to specify something different?
Thanks,
Ben
"Brian Moran" <brian@.solidqualitylearning.com> wrote in message
news:eD3OdfKdEHA.3864@.TK2MSFTNGP10.phx.gbl...
> You can manage this using the Client Network Utillity on the client
machine.[vbcol=seagreen]
> From the server, you can tell what netlib a client is connecting on by
> looking at the net_library column in master..sysprocesses.
> --
> Brian Moran
> Principal Mentor
> Solid Quality Learning
> SQL Server MVP
> http://www.solidqualitylearning.com
>
> "Becker" <ben@.benbecker.net> wrote in message
> news:OAtKhaKdEHA.3988@.tk2msftngp13.phx.gbl...
> problem
pipes.[vbcol=seagreen]
> I
use
> Is
>

How choose net lib on client side?

I have SQL Server 7 and it has in the network config utility TCP, Named
Pipes and Multiprotocol. I want to use TCP on my clients, the only problem
is I don't know how to set them up to use this as opposed to named pipes. I
do not want to authenticate at the OS level so I'm trying to get it to use
plain old TCP. By default, all of them appear to be using named pipes. Is
there some way I can confirm or change this theory?
Thanks,
BenYou can manage this using the Client Network Utillity on the client machine.
From the server, you can tell what netlib a client is connecting on by
looking at the net_library column in master..sysprocesses.
--
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Becker" <ben@.benbecker.net> wrote in message
news:OAtKhaKdEHA.3988@.tk2msftngp13.phx.gbl...
> I have SQL Server 7 and it has in the network config utility TCP, Named
> Pipes and Multiprotocol. I want to use TCP on my clients, the only
problem
> is I don't know how to set them up to use this as opposed to named pipes.
I
> do not want to authenticate at the OS level so I'm trying to get it to use
> plain old TCP. By default, all of them appear to be using named pipes.
Is
> there some way I can confirm or change this theory?
> Thanks,
> Ben
>|||Interesting, so if I don't have the sql client loaded on a machine, what net
library will it use by default? E.g. I have a fresh install of win 2k with
an app that connects to SQL Server, I haven't loaded a client on it but the
app works just fine and it is using named pipes. I want it to use tcp/ip,
do i have to load the client to specify something different?
Thanks,
Ben
"Brian Moran" <brian@.solidqualitylearning.com> wrote in message
news:eD3OdfKdEHA.3864@.TK2MSFTNGP10.phx.gbl...
> You can manage this using the Client Network Utillity on the client
machine.
> From the server, you can tell what netlib a client is connecting on by
> looking at the net_library column in master..sysprocesses.
> --
> Brian Moran
> Principal Mentor
> Solid Quality Learning
> SQL Server MVP
> http://www.solidqualitylearning.com
>
> "Becker" <ben@.benbecker.net> wrote in message
> news:OAtKhaKdEHA.3988@.tk2msftngp13.phx.gbl...
> > I have SQL Server 7 and it has in the network config utility TCP, Named
> > Pipes and Multiprotocol. I want to use TCP on my clients, the only
> problem
> > is I don't know how to set them up to use this as opposed to named
pipes.
> I
> > do not want to authenticate at the OS level so I'm trying to get it to
use
> > plain old TCP. By default, all of them appear to be using named pipes.
> Is
> > there some way I can confirm or change this theory?
> >
> > Thanks,
> > Ben
> >
> >
>

How choose net lib on client side?

I have SQL Server 7 and it has in the network config utility TCP, Named
Pipes and Multiprotocol. I want to use TCP on my clients, the only problem
is I don't know how to set them up to use this as opposed to named pipes. I
do not want to authenticate at the OS level so I'm trying to get it to use
plain old TCP. By default, all of them appear to be using named pipes. Is
there some way I can confirm or change this theory?
Thanks,
BenYou can manage this using the Client Network Utillity on the client machine.
From the server, you can tell what netlib a client is connecting on by
looking at the net_library column in master..sysprocesses.
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Becker" <ben@.benbecker.net> wrote in message
news:OAtKhaKdEHA.3988@.tk2msftngp13.phx.gbl...
> I have SQL Server 7 and it has in the network config utility TCP, Named
> Pipes and Multiprotocol. I want to use TCP on my clients, the only
problem
> is I don't know how to set them up to use this as opposed to named pipes.
I
> do not want to authenticate at the OS level so I'm trying to get it to use
> plain old TCP. By default, all of them appear to be using named pipes.
Is
> there some way I can confirm or change this theory?
> Thanks,
> Ben
>|||Interesting, so if I don't have the sql client loaded on a machine, what net
library will it use by default? E.g. I have a fresh install of win 2k with
an app that connects to SQL Server, I haven't loaded a client on it but the
app works just fine and it is using named pipes. I want it to use tcp/ip,
do i have to load the client to specify something different?
Thanks,
Ben
"Brian Moran" <brian@.solidqualitylearning.com> wrote in message
news:eD3OdfKdEHA.3864@.TK2MSFTNGP10.phx.gbl...
> You can manage this using the Client Network Utillity on the client
machine.
> From the server, you can tell what netlib a client is connecting on by
> looking at the net_library column in master..sysprocesses.
> --
> Brian Moran
> Principal Mentor
> Solid Quality Learning
> SQL Server MVP
> http://www.solidqualitylearning.com
>
> "Becker" <ben@.benbecker.net> wrote in message
> news:OAtKhaKdEHA.3988@.tk2msftngp13.phx.gbl...
> problem
pipes.[vbcol=seagreen]
> I
use[vbcol=seagreen]
> Is
>

How cany I publish 1 table from an attached database?

Hello,

In my vb.net application, I have an attached database called dbMaster with the following tables:

tblCustomer, tblProducts, tblUsers

In visual studio 2005, is it possible to publish only one table? My problem is, is that I want to send my end users updated data from my tblCustomer, and am finding that on my test laptop, if I publish dbMaster, it sends all tables when I just want one to be sent.

Thanks in advance.

Are you taking about setting up a Replication Publication? SQL Express doesn't support Replication Publications.

Mike

|||

Yes, I was thinking along those lines, but could not find any support for it... ok thanks.

|||

Replication will allow you to specify specific tables, refered to as Articles, as part of the Publication. You'll just need to look at one of the other Editions of SQL Server to be the Publisher. I typically recommend SQL Workgroup Edition for small scale systems.

Mike

|||I'm working on a mobile application. I want to have a desktop database that is kept in sync with a handheld database, with updates occurring on both ends. To keep them synchronized, I am investigating the use of both RDA and Replication. I've gotten RDA to work, but have found a major drawback: Every time you sync, you have to basically pull down a new version of ALL the data, not just the changes.

So I started to look into using Replication. If I understand correctly, using Replication, you can do synchronization where only the changes have to be exchanged between the handheld device and the desktop computer. But as I just found out from the above post, you cannot create a Publication using SQLExpress.

Why do I want to use SQLExpress? Because I need a version of SQL Server that I can distribute for free with my application. Am I wrong, or is SQLExpress that only one that has a free redistributable?

Taking a step back, am I missing something? Is there a better (simpler?) alternative to RDA and Replication?

Thanks for any advice!

Tom

How can you use SQL Full Text Search CONTAINS() with an asp.net 2.0 ObjectDataSource using

How can you use SQL Full Text Search CONTAINS() with an asp.net 2.0 ObjectDataSource using @.Parameters?

MSDN says something like this, but only works directly using like the Query from SQL Manager:

USE TestingDB;
GO
DECLARE @.SearchWord NVARCHAR(30)
SET @.SearchWord = N'performance'
SELECT TestText
FROM TestingTable
WHERE CONTAINS(TestText, @.SearchWord);

I tryed to mak something like that work with the DataSet DataAdapter Query Builder for the ObjectDataSource, but you can't use DECLARE or SET.

SELECT TestText
FROM TestingTable
WHERE CONTAINS(TestText, @.SearchWord);

But again it says @.SearchWord not a valide SQL Construct

Is there anyway to make a DataSet.DataApater.ObjectDataSource work with an SQL FTS CONTAINS() with @.Parameters?

Have you tried putting it into a stored procedure?

|||

No, I habe not tried using a stored procedure, thanks for the reminder, I will try that, if it works out great I will tell you, thanks.

|||

In the query window I do:

DECLARE @.SearchWord NVARCHAR(128)

SET @.SearchWord = N'Water'

SELECT Answers.BusinessId, Answers.BusinessName, BusinessType.TypeEN, BusinessType.TypeFR, BusinessMainType.TypeEN AS MainTypeEN, BusinessMainType.TypeFR AS MainTypeFR, Answers.CallBackTypeId, Answers.Q1b, Answers.IsOwnerFrench, Answers.Q2aId

FROM Answers

INNER JOIN BusinessType ON Answers.BusinessTypeId = BusinessType.BusinessTypeId

INNER JOIN BusinessMainType ON Answers.BusinessMainTypeId = BusinessMainType.BusinessMainTypeId

WHERE

(Answers.CallBackTypeId = 1) AND CONTAINS(Answers.BusinessName, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessType.TypeEN, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessType.TypeFR, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessMainType.TypeEN, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessMainType.TypeFR, @.Keywords)

ORDER BY Answers.BusinessName

END

It works great and I get the values returned that I should, but only in the SQL Manager 2005, or a query in visual studio 2005, and not in the DataSet Builder for ObjectDataSource.

When I do this as a stored procedure as:

CREATE PROCEDURE SP_Keywords

@.Keywords NVARCHAR(128)

AS

BEGIN

SELECT Answers.BusinessId, Answers.BusinessName, BusinessType.TypeEN, BusinessType.TypeFR, BusinessMainType.TypeEN AS MainTypeEN, BusinessMainType.TypeFR AS MainTypeFR, Answers.CallBackTypeId, Answers.Q1b, Answers.IsOwnerFrench, Answers.Q2aId

FROM Answers

INNER JOIN BusinessType ON Answers.BusinessTypeId = BusinessType.BusinessTypeId

INNER JOIN BusinessMainType ON Answers.BusinessMainTypeId = BusinessMainType.BusinessMainTypeId

WHERE

(Answers.CallBackTypeId = 1) AND CONTAINS(Answers.BusinessName, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessType.TypeEN, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessType.TypeFR, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessMainType.TypeEN, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessMainType.TypeFR, @.Keywords)

ORDER BY Answers.BusinessName

END

It prompts me for the value of the @.Keywords, I get 0 rows returned, it does execute properly no errors, and it is connecting to the right DB/Tables so on.

I'm new to stored procedures, I normaly just use SQL Queries, but I see all the advantages of using Stored Procedures.

Can you help me if you can please and thank you?

|||

Your queries are bad code. You cannot mix AND with OR like you have done. It is afundamental logic error.

You must use ( ) around the various units of code that go together.

Example

WHERE ( Answers.CallBackTypeId = 1
AND CONTAINS(Answers.BusinessName, @.Keywords)
)
OR ( Answers.CallBackTypeId = 1
AND CONTAINS(BusinessType.TypeEN, @.Keywords)
)
OR ...

END

WHERE Answers.CallBackTypeId = 1
AND ( CONTAINS(Answers.BusinessName, @.Keywords)
OR CONTAINS(BusinessType.TypeEN, @.Keywords)
OR ...
)

|||

I knew that, I actualy wrote the script the way you did, but like always visual studio likes to change code auto formatting crap even do that option is off, and it converted it to what I posted.

Yes the script still works even do it's mixed like it is with AND/OR, I tested it both ways, comes out with the same results, it's just the script is longer that's all, no bad.

So let me restate my problem, lets not go off track since the script works.

In the query window I do:

DECLARE @.SearchWord NVARCHAR(128)

SET @.SearchWord = N'Water'

SELECT Answers.BusinessId, Answers.BusinessName, BusinessType.TypeEN, BusinessType.TypeFR, BusinessMainType.TypeEN AS MainTypeEN, BusinessMainType.TypeFR AS MainTypeFR, Answers.CallBackTypeId, Answers.Q1b, Answers.IsOwnerFrench, Answers.Q2aId

FROM Answers

INNER JOIN BusinessType ON Answers.BusinessTypeId = BusinessType.BusinessTypeId

INNER JOIN BusinessMainType ON Answers.BusinessMainTypeId = BusinessMainType.BusinessMainTypeId

WHERE

(Answers.CallBackTypeId = 1) AND CONTAINS(Answers.BusinessName, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessType.TypeEN, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessType.TypeFR, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessMainType.TypeEN, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessMainType.TypeFR, @.Keywords)

ORDER BY Answers.BusinessName

END

It works great and I get the values returned that I should, but only in the SQL Manager 2005, or a query in visual studio 2005, and not in the DataSet Builder for ObjectDataSource.

When I do this as a stored procedure as:

CREATE PROCEDURE SP_Keywords

@.Keywords NVARCHAR(128)

AS

BEGIN

SELECT Answers.BusinessId, Answers.BusinessName, BusinessType.TypeEN, BusinessType.TypeFR, BusinessMainType.TypeEN AS MainTypeEN, BusinessMainType.TypeFR AS MainTypeFR, Answers.CallBackTypeId, Answers.Q1b, Answers.IsOwnerFrench, Answers.Q2aId

FROM Answers

INNER JOIN BusinessType ON Answers.BusinessTypeId = BusinessType.BusinessTypeId

INNER JOIN BusinessMainType ON Answers.BusinessMainTypeId = BusinessMainType.BusinessMainTypeId

WHERE

(Answers.CallBackTypeId = 1) AND CONTAINS(Answers.BusinessName, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessType.TypeEN, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessType.TypeFR, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessMainType.TypeEN, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessMainType.TypeFR, @.Keywords)

ORDER BY Answers.BusinessName

END

It prompts me for the value of the @.Keywords, I get 0 rows returned, it does execute properly no errors, and it is connecting to the right DB/Tables so on.

I'm new to stored procedures, I normaly just use SQL Queries, but I see all the advantages of using Stored Procedures.

Can you help me if you can please and thank you?

|||

cdmlb:

In the query window I do:

DECLARE @.SearchWord NVARCHAR(128)

SET @.SearchWord = N'Water'

SELECT Answers.BusinessId, Answers.BusinessName, BusinessType.TypeEN, BusinessType.TypeFR, BusinessMainType.TypeEN AS MainTypeEN, BusinessMainType.TypeFR AS MainTypeFR, Answers.CallBackTypeId, Answers.Q1b, Answers.IsOwnerFrench, Answers.Q2aId

FROM Answers

INNER JOIN BusinessType ON Answers.BusinessTypeId = BusinessType.BusinessTypeId

INNER JOIN BusinessMainType ON Answers.BusinessMainTypeId = BusinessMainType.BusinessMainTypeId

WHERE

(Answers.CallBackTypeId = 1) AND CONTAINS(Answers.BusinessName, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessType.TypeEN, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessType.TypeFR, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessMainType.TypeEN, @.Keywords) OR

(Answers.CallBackTypeId = 1) AND CONTAINS(BusinessMainType.TypeFR, @.Keywords)

ORDER BY Answers.BusinessName

END

Well, the obvious thing to ask you is why you are setting @.SearchWord and searching for @.Keywords in the query studio version. The query in the query studio and in the stored procedure are not the same!

Friday, March 9, 2012

How can pass variable or parameter in DATA READER SOURCE ising ADO:NET Connection manager

In SSIS in Sql task we have option to pass parameter or variable..But in Data Flow Task when we use Data Reader Source using ADO.NET connection..There is no option to pass parameter or variable Or no option to receive a parameter or variable .

I am having a query were it need to pass a parameter.in sql task ...And Data Reader Source have to receive this parameter from sql task .

Sql Task finds a value of parameter and pass to DataReader Source in DataFlow Task .. ...

Please can any one help me to solve this problem of Receiving parameter or variable in DataReader Source using DAO.Net connection in DataFlow Task..thank you dilsa

USe an expression to override SQLCommand porperty of the data reader:

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

Wednesday, March 7, 2012

how can it automatically generating a ordered number

hi,

i am a newcomer and a freshman in asp.net. i am now writing a web-based system for SME as my final year project. i am going to use sql server and asp.net in C# to perform my final year project.

as asp.net is new for me, i would have some simple problems to ask.

1. in the project, i would like the system can automatically generate the enquiry number for each new order input to the system. for example today is 05 July 2006, the enquiry number would like 2006211xxxx, where 2006 is year, 211 is the day count start from 1 Jan and xxxx is the random number/ ordered number. how can i implement this? i even don't know how to generate the ordered number. could anyone help me

2. if there is an unknown test sample in each order input. as the sample number for each order is different, how can i set a flexible table that can have different number of rows for user to input the test result.

thanks

Rgds, universe

1. I suggest you can have two columns: one used to record the inserted data for the row, another for row ID. So you can create a table as following:

create table tbl_test(id int identity(1,1),RecDate smalldatetime default getdate(), Description varchar(200))
create table tbl_test1(id uniqueidentifier default newid(),RecDate smalldatetime default getdate(), Description varchar(200))

insert into tbl_test(description) select 'This is a test row'

insert into tbl_test1(description) select 'This is a test row'

2. Sorry I'm not clear about this issue

How can I use SQL Report in ASP.NET?

Hi,

Can I use SQL Reports in ASP.NET? Please help me how it is working. Can I use more than one tables in query?

Arun.

You can use reportviewer from VS in your ASP.NET. You may have it for the express version through SP1. You also can use multiple tables in your query through JOINS for example. If you mean for the ReportViewer datasource, you can use multple datasources for the reportviwer. I hope I answer your question in a generic way. If you have specific questions, I will try to share what I know.

Friday, February 24, 2012

How can I use Reporting Services on ASP.NET Pages?

Hi all,

Could you tell the correct way to use Reporting Services on ASP.NET pages?

Now I wanna create an ASP.NET page to show some reports, and I hope to control all logic by program, so I need know the API between ASP.NET and Reporting Services.

For example, I wanna pass some data to Reporting Services via API, and then Reporting Services handle the data and return reports to me, and then I can show the reports on my web pages.

Please tell me how?

Hi Xinwen.

You can use the Report control and give hime the link to your report so it will show in side the control.

You don't interact with the report like you described - You can interact with the report with PARAMETERS passing through the URL.

So whan you give the report control the report url you can add to that url parameters that the report should get (like person id or project number) and also to change things in the report (like open it in diffrent ways, change the zoom, automaticlly export to pdf and so on) with the url command parameters.

for exm:
ttp://reportserver/myreportfolder/reportname.rdl?rc:format=PDF will export it to pdf.

search google about "report service url parameters"

good luck,
Roy.|||Thanks Roy!

How can I use Reporting Services on ASP.NET Pages?

Hi all,

Could you tell the correct way to use Reporting Services on ASP.NET pages?

Now I wanna create an ASP.NET page to show some reports, and I hope to control all logic by program, so I need know the API between ASP.NET and Reporting Services.

For example, I wanna pass some data to Reporting Services via API, and then Reporting Services handle the data and return reports to me, and then I can show the reports on my web pages.

Please tell me how?

Hi Xinwen.

You can use the Report control and give hime the link to your report so it will show in side the control.

You don't interact with the report like you described - You can interact with the report with PARAMETERS passing through the URL.

So whan you give the report control the report url you can add to that url parameters that the report should get (like person id or project number) and also to change things in the report (like open it in diffrent ways, change the zoom, automaticlly export to pdf and so on) with the url command parameters.

for exm:
ttp://reportserver/myreportfolder/reportname.rdl?rc:format=PDF will export it to pdf.

search google about "report service url parameters"

good luck,
Roy.
|||Thanks Roy!|||

Hi,

I tried with this but instead of prompting to save Excel File,it is displaying the report

http://localhost/Reports/Pages/Report.aspx?ItemPath=NameOfReport&rs:Command=Renderl&rs:Format=Excel

-Thanks,

Digant Desai

|||

In Visual studio 2005,there is a report veiwer contrlo to view your RDL reports.

U need to link report viewer control to corresponding report in Reporting service project.This u can do

by setting Propertis of report viewer.

You can also pass parameters form ASP page to rdl file.

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.ReportViewer2.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{


this.ReportViewer2.Visible = true;
this.ReportViewer2.ServerReport.ReportServerUrl = new System.Uri("
http://localhost/ReportServer");


string strReport = "/ReportProject14/Report1";

this.ReportViewer2.ServerReport.ReportPath = strReport;

Microsoft.Reporting.WebForms.ReportParameter[] RptParameters =
new Microsoft.Reporting.WebForms.ReportParameter[3];

string strComp = this.DropDownList1.SelectedItem.Value;
RptParameters[0] =
new Microsoft.Reporting.WebForms.ReportParameter("INTCOMPANYKEY", strComp);

string strFacility = this.DropDownList3.SelectedItem.Value;
RptParameters[1] =
new Microsoft.Reporting.WebForms.ReportParameter("INTFACILITYKEY", strFacility);

string strActivity = this.DropDownList2.SelectedItem.Value;
RptParameters[2] =
new Microsoft.Reporting.WebForms.ReportParameter("Activity", strActivity);

this.ReportViewer2.ServerReport.SetParameters(RptParameters);
this.ReportViewer2.ServerReport.Refresh();
}
}

How can I use mdf files from sql server 2005 exp. edition.

Hello,

I am a candidate for web programming..I would like to desing a website and I have a good host which is supporting .net 2.0 and sql server 2005 service. So I would like to ask you

1) how can I use sql server express edition's mdf database file there. or Can I store and use this "mdf"s in ftp folder? What should I do. ..

2) I have only one database "right" there and should I manage everything in one database. For example asp.net configuration manager created ASPNETDB.mdf and ldf...so if Can you inform me about this issue?

Maybe my questions is not advance, they are very basic but I want to learn

Thank you very much for your helps.

Hi,

From your description, it seems that you want to deploy the database in your SQLExpress to the SQLServer2005 database on your host server, right?

If so, I suggest that you should use some tools to achieve that instead of attaching MDF manually. First, you may use aspnet_regsql.exe tool convert the database in SQLExpress to your local SQLServer series database. In you case it's SQLServer2005. After that, use SQLServer export and import wizard to upload the database (including table and schema) to the SQLServer2005 instance on your server.

For aspnet_regsql.exe, see:

http://msdn2.microsoft.com/en-us/library/ms229862.aspx

Thanks.

How can I use create or alter statements with ODBC and Microsoft Access ODBC Driver (*mdb)?

Hi,

I am using VB.NET 2005 and set up an ODBC connection via ODBC.ODBCConnection to a MDB database. Therefor, I use the "Microsoft Access ODBC Driver (*.mdb)".

When I set up a ODBCCommand like "ALTER DATABASE..." or "CREATE TABLE..." and issue it with the com.ExecuteNonQuery() command, I get an error from ODBC driver, that a SQL statement has to begin with SELECT, INSERT, UPDATE or DELETE.

How can I use DDL statements via ODBC?

I would appreciate if you could help me to use ODBC for that - no OLE, no ADO.

Thanks for help!

Regards,

Stefan D.

Once upon a time (if I recall correctly -and even if I don't it makes for a good 'story')...

OBDC (Open DataBase Connectivity) was established as a result of a consortium of product vendors working to find a common API to allow users using a common 'language' (ANSI SQL) to access data in any vendors database. So far, the supported ANSI SQL is limited to SELECT INSERT, UPDATE, DELETE statements.

Each vendor has proprietary extensions to the SQL Language to create/define/change/remove the database objects.

Short version -you can't.

Your choices are to use the vendor specific database management tool to create the tables, and then use ODBC to handle the data operations,

(OR), embrace ADO, or even OLEDB.

|||

Ah, that's a pity, but thanks for your answer!

So then I have to use ADO. Is there a way to get access to any database format that is stored in files (like .mdb) without having to install a driver for it on a standard windows XP installation? For OLE to mdb I have to install the JET-Engine, am I right?

Thanks for answer again!

|||

This may be wrong, but, I think that the full JET functionality is included in MDAC 2.x, and that MDAC 2.x is automatically included with and installed with Windows OS (since Win 2000/XP) and service packs.

|||Alternatively, you might also consider using SQL Server Express or SQL Server CE as your backend database and then using the System.Data.SqlClient as your provider API. This would also be beneficial in that your developement experience would be greatly simplified with the data scenario support that is provided in Visual Studio 2005.|||

Well, if it is true that JET is installed with Windows service pack, then I wonder why I get an ISAM not found error...

|||

My software is already supporting MySQL and Oracle back ends (Oracle is in its XE 10g version also free) with a single class working with ODBC. That's the reason why I wanted to use ODBC to access the mdb, too.

In addition to the two server-based solutions now I want a third, file-based solution which is slim enough for a standard business laptop (which are server-based solutions definitely not) and does not need any extra installation effort (like an extra driver or database server).

So, thanks for your reply, but I still insist on a file-based solution. Any ideas?

|||

Stephan,

You might explore SQL Server CE (or maybe it's now called 'Mobile'). Very small footprint, very small demand on resources -and yet suprisingly a lot of functionality.

And as i indicated before, the JET drivers are automatically installed on Windows 2000 and above.

|||

ISAM not found errors are often a result of incorrect or improperly formed connection strings.

Check this thread for one type of problem.

|||

That's the reason why I wanted to use ODBC to access the mdb, too.

You CAN use ODBC to access the mdb file -SELECT, INSERT, UPDATE, DELETE works the same as in MySQL or ORACLE.

You just can't use ODBC to CREATE TABLES, etc.

You have to use JET (ADO / OLEDB) for that.

|||

Great, thank you!

After you've convinced me that Jet is really installed in standard windows installation, I came closer to my error. Didn't know that the OLE driver does not like additionally specified parameters in that string than those it needs.

Now it works, thanks!

This problem is thus resolved.

Thanks much to all for your help!

|||

After you've convinced me that the driver is really installed in an original windows installation, I came close to the real error. My connection string was indeed malformulated.

Thanks to all for their help!

This issue is thus resolved!

How can I use create or alter statements with ODBC and Microsoft Access ODBC Driver (*mdb)?

Hi,

I am using VB.NET 2005 and set up an ODBC connection via ODBC.ODBCConnection to a MDB database. Therefor, I use the "Microsoft Access ODBC Driver (*.mdb)".

When I set up a ODBCCommand like "ALTER DATABASE..." or "CREATE TABLE..." and issue it with the com.ExecuteNonQuery() command, I get an error from ODBC driver, that a SQL statement has to begin with SELECT, INSERT, UPDATE or DELETE.

How can I use DDL statements via ODBC?

I would appreciate if you could help me to use ODBC for that - no OLE, no ADO.

Thanks for help!

Regards,

Stefan D.

Once upon a time (if I recall correctly -and even if I don't it makes for a good 'story')...

OBDC (Open DataBase Connectivity) was established as a result of a consortium of product vendors working to find a common API to allow users using a common 'language' (ANSI SQL) to access data in any vendors database. So far, the supported ANSI SQL is limited to SELECT INSERT, UPDATE, DELETE statements.

Each vendor has proprietary extensions to the SQL Language to create/define/change/remove the database objects.

Short version -you can't.

Your choices are to use the vendor specific database management tool to create the tables, and then use ODBC to handle the data operations,

(OR), embrace ADO, or even OLEDB.

|||

Ah, that's a pity, but thanks for your answer!

So then I have to use ADO. Is there a way to get access to any database format that is stored in files (like .mdb) without having to install a driver for it on a standard windows XP installation? For OLE to mdb I have to install the JET-Engine, am I right?

Thanks for answer again!

|||

This may be wrong, but, I think that the full JET functionality is included in MDAC 2.x, and that MDAC 2.x is automatically included with and installed with Windows OS (since Win 2000/XP) and service packs.

|||Alternatively, you might also consider using SQL Server Express or SQL Server CE as your backend database and then using the System.Data.SqlClient as your provider API. This would also be beneficial in that your developement experience would be greatly simplified with the data scenario support that is provided in Visual Studio 2005.|||

Well, if it is true that JET is installed with Windows service pack, then I wonder why I get an ISAM not found error...

|||

My software is already supporting MySQL and Oracle back ends (Oracle is in its XE 10g version also free) with a single class working with ODBC. That's the reason why I wanted to use ODBC to access the mdb, too.

In addition to the two server-based solutions now I want a third, file-based solution which is slim enough for a standard business laptop (which are server-based solutions definitely not) and does not need any extra installation effort (like an extra driver or database server).

So, thanks for your reply, but I still insist on a file-based solution. Any ideas?

|||

Stephan,

You might explore SQL Server CE (or maybe it's now called 'Mobile'). Very small footprint, very small demand on resources -and yet suprisingly a lot of functionality.

And as i indicated before, the JET drivers are automatically installed on Windows 2000 and above.

|||

ISAM not found errors are often a result of incorrect or improperly formed connection strings.

Check this thread for one type of problem.

|||

That's the reason why I wanted to use ODBC to access the mdb, too.

You CAN use ODBC to access the mdb file -SELECT, INSERT, UPDATE, DELETE works the same as in MySQL or ORACLE.

You just can't use ODBC to CREATE TABLES, etc.

You have to use JET (ADO / OLEDB) for that.

|||

Great, thank you!

After you've convinced me that Jet is really installed in standard windows installation, I came closer to my error. Didn't know that the OLE driver does not like additionally specified parameters in that string than those it needs.

Now it works, thanks!

This problem is thus resolved.

Thanks much to all for your help!

|||

After you've convinced me that the driver is really installed in an original windows installation, I came close to the real error. My connection string was indeed malformulated.

Thanks to all for their help!

This issue is thus resolved!

How can i upload the files(any kinda) onto the database??

Hi everyone,

I am developing an web-database application using ASP.NET, C# and sql server 2000 .

In the application i want to upload different scanned files (pdf,doc,excel,jpeg,ttf,etc) onto the database.. how can i carry out this task :-?

If any one got the solution.. then, please let me know...

thanks in advance

Step 1: Use the ASP.NET file input control to let the user select a file. This is in the HTML section of the toolbox.

Step 2: Make sure that the is set correctly to support file uploads. This means settings its encType to multipart/form-data.

Step 3: Read the file details on the server side code from the Page.Request.Files property.

Step 4: From here you can then save the files to disk and just add an index to them in the database, or you can save their contents into the DB itself (as BLOBs).

Hope this helps.|||

Hey thanx man..

Will try it out.. and if any probs will ask for ur help

|||

Hi,

It really helped me.. but can u plz repeat the 2nd step.. coz.. theres a bit confusion reading that :(

|||In order to allow the uploading of files, you need to set the encType property of your form element.

Open the .aspx file in HTML view, locate the element and add

encType="multipart/form-data" inside the element.

e.g.

Essentially, this allows you to upload a combination of files and form variables.

Hope this helps.|||

Hey thanx U soo much man..

well i gonna try out this and will definitely tell u the out-put of the same.

Thanx again, and keep the good work going

|||

Hi,

I couldnt add the encType="multipart/form-data" into the file input :(

when i tried adding it to the input tag of the file, it gave an parse error,,

So, plz let me know the soln..

<form id="Form1" method="post" runat="server">
<asp:Label id="Label2" style="Z-INDEX: 102; LEFT: 386px; POSITION: absolute; TOP: 106px" runat="server"
ForeColor="Maroon" Font-Size="Medium" Font-Bold="True" Width="265px">Uploading new Employee Details</asp:Label><INPUT style="Z-INDEX: 121; LEFT: 494px; POSITION: absolute; TOP: 431px" type="file" id="File1" name="File1" runat="server">

I tried adding it in the input tag, but encountered an parse error,hope i will get the soln,,

thanks in advance


|||You need to add the encType attribute to the form element, not the input element.

Sunday, February 19, 2012

How can I track the queries being issued against my sql server 2000 instance?

I have an ASP.NET app built on top of SQL Server 2000. My app is running slowly and I think I'm issuing too many queries to the database.

How can I track the queries, and when they are being issued, against my sql server 2000 instance? Is there a tool to view the queries, or is it all in a log file somewhere?

This will help me tune my ASP.NET caching strategy.

Any help is greatly appreciated!

Franco

Use SQL Server Profiler|||Choose: SQL Server, Tools, SQL Profile, File, New, Trace, Choose Server...

On the filters tab of the new window you see you can choose various filters. These include database name, application name, NT UserName, there are many to choose from.

SQL Profiler is an amazing tool for seeing whats happening "under the hood" I suggest you really read up on it in SQL Books Online as its extremely powerful.

Keep us all up to date with how you are getting on.

hth

Pace
|||Fantastic... just what I needed. Thanks!

How can I track the queries being issued against my sql server 2000 instance?

I have an ASP.NET app built on top of SQL Server 2000. My app is running slowly and I think I'm issuing too many queries to the database.

How can I track the queries, and when they are being issued, against my sql server 2000 instance? Is there a tool to view the queries, or is it all in a log file somewhere?

This will help me tune my ASP.NET caching strategy.

Any help is greatly appreciated!

Franco

Use SQL Server Profiler|||Choose: SQL Server, Tools, SQL Profile, File, New, Trace, Choose Server...

On the filters tab of the new window you see you can choose various filters. These include database name, application name, NT UserName, there are many to choose from.

SQL Profiler is an amazing tool for seeing whats happening "under the hood" I suggest you really read up on it in SQL Books Online as its extremely powerful.

Keep us all up to date with how you are getting on.

hth

Pace
|||Fantastic... just what I needed. Thanks!