Showing posts with label asp. Show all posts
Showing posts with label asp. Show all posts

Tuesday, March 27, 2012

Easy User Question

I have a user set up on a SQL 200 server, which I am using to connect to a
database from an ASP.NET application I am making.
When I run the application from the same system as the database is on, the
connection works correctly ( my connection string is:
user id=BlueMaster;data source=BLUE;initial
catalog=BlueSky;password=bluerocks
)
but when I try to connect when running the application off another system,
the connection fails. What do I have to do to set up the user so the
connection will work from remote systems'
ThanksCheck you are using SQL server and Windows authentication in SQL Server (the
defualt is Windows only)
Do this from Enterprise manager - right click the server name, go to
properties and the Security tab. If you do have to change the mode you will
be prompted to restart SQL Server - this is necessary for the security
setting to take effect. If this is not the problem, can you please post the
error message coming back
"Ryan" <web@.balancestudios.com> wrote in message
news:e5321K71DHA.1100@.TK2MSFTNGP10.phx.gbl...
quote:

> I have a user set up on a SQL 200 server, which I am using to connect to a
> database from an ASP.NET application I am making.
> When I run the application from the same system as the database is on, the
> connection works correctly ( my connection string is:
> user id=BlueMaster;data source=BLUE;initial
> catalog=BlueSky;password=bluerocks
> )
> but when I try to connect when running the application off another system,
> the connection fails. What do I have to do to set up the user so the
> connection will work from remote systems'
> Thanks
>
|||What error message do you get when it fails?
Rand
This posting is provided "as is" with no warranties and confers no rights.

Monday, March 26, 2012

easy question... i think

I have a ASP page where the user posts part of the name field. Then i need to provides the matches. (providing partial comparision of the field & correcting bad spelling)

example:

User posts 'softwair' (should be software)

the query look like this
Select Name from A where Name is like '%softwair%' <-- but appling soundex on it in the like field, or something like it.

I could make a copy of the column and update all info in the field to the soundex value, but then the like statement would not get it if the value was only part of it. for example say the data values where like 'Microsoft Software', or 'My Software Solutions', ect...You don't need to "update" the column to the soundex result, just create a computed column that would use soundex(field_name) as a function. But this will only answer the misspelling question.

select soundex('software'), soundex('softwair')

results in 'S136' for both.

Easy method of Forms Authentication

Does anybody know if it is possible to create an ASP.NET webform (Form1)
that simply recieves a request from a client browser, and then sends that
request (changing a few bits as necessary) on to another page (Form2). The
response from Form2 will then be digested by Form1 and returned to client
browser.
I know that Server.Transfer has limitations, in that it only works between
ASPX forms, but this would be a great way of getting around all of the
Authentication problems in Report Services and sounds really easy.
You would just have to add some credentials, parameters if required and hey
presto, your in.
There may be a bit of a complicated conversation on the way through - but
this cant be as difficult as all the stuff that is going on here for
integeration.
Please somebody either add there support for this issue, or answer it as it
would solve loads of peoples issues.
Thanks in advance.
--
Message posted via http://www.sqlmonster.comThe Forms Authentication sample code provided by Microsoft is about as easy
as it can get for integrating with Reporting Services. We have used this as
a starting point to integrate with our own ASP.NET applications and
single-sign-on solution. If you have questions about this, please feel free
to post back.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"Tom Robson via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:47c0624d6e254541b1877708761a9ea9@.SQLMonster.com...
> Does anybody know if it is possible to create an ASP.NET webform (Form1)
> that simply recieves a request from a client browser, and then sends that
> request (changing a few bits as necessary) on to another page (Form2). The
> response from Form2 will then be digested by Form1 and returned to client
> browser.
> I know that Server.Transfer has limitations, in that it only works between
> ASPX forms, but this would be a great way of getting around all of the
> Authentication problems in Report Services and sounds really easy.
> You would just have to add some credentials, parameters if required and
> hey
> presto, your in.
> There may be a bit of a complicated conversation on the way through - but
> this cant be as difficult as all the stuff that is going on here for
> integeration.
> Please somebody either add there support for this issue, or answer it as
> it
> would solve loads of peoples issues.
> Thanks in advance.
> --
> Message posted via http://www.sqlmonster.com

Wednesday, March 7, 2012

dynamically binding button and controls on table rows.

Hi,

I am new to .NET world. I am using visual studio express.

I am developing website using ASP.NET and C#.

I want to add buttons dynamically on a table row on my web page.

For this I have written this code in "example.aspx" file

<asp:TableID="tblExample"GridLines="Both"BorderWidth="1"runat="server">

</asp:Table>

In my corresponding "example.aspx.cs" file i have written

TableRow tr = new TableRow();

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

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

TableCell tc3 = new TableCell();

tc3.Width = 120;

Button bt = new Button();

bt.Text = btnStop.Text;

bt.Width = 120;

bt.CommandArgument = lrs.IpAddress + ":" + lrs.PortNo;

bt.Click += newEventHandler(cmdStop_Click);

tc3.Controls.Add(bt);

tr.Cells.Add(tc3);

tblExample.Rows.Add(tr);

In my EventHandler "cmdStop_Click" I am trying to perform some action but on that particular row's data.

My page is also reloading after every 5 secs.

After clicking a button in a row, when page refreshes, I am getting this message in popup error message. also that entry is ommited(as per code in EventHandler)

"The Page cannot be refreshed without resending the information.

Click retry to resend the information again.

or click Cancel to return to the page that you were trying to view"

resetButton cancelButton

_

How to bind that button to particular row so that when I click on a button the action should be performed on that particular row's data.

Thanks

Smile

I think that if you visit this site, you will find quite a few very good instructional videos that will help you create your website.

http://asp.net/learn/videos/default.aspx?tabid=63

Your question is not really a SQL Server question, but more one of how to get started and learn ASP programming. Check out the site above.

Friday, February 17, 2012

Dynamic SQL Queries!

An ASP application retrieves the DISTINCT records from all the columns
of a SQL Server DB table & populates them in drop-down lists. The no.
of drop-down lists on the web page depends upon the no. of columns in
the DB table. For e.g. if the DB table has, say, 5 columns, the web
page will show 5 drop-down lists.
Assume that the DB table stores information pertaining to books like
book name, category to which the book belongs to like sports, science,
music etc., author, publisher, publishing date etc.
Now suppose that a user selects an author named Author1 from the
drop-down list. When he does so, the page should get submitted & all
books that Author1 has penned should be displayed to the user. For e.g.
if Author1 has written 10 books, the user should be shown 10 records.
Now after Author1 has been selected & the appropriate records displayed
to the user, suppose the user selects an option from another drop-down
list like for e.g. the publisher drop-down list. An author can get his
books published by different publishers. When the user selects, say,
Publisher1, from the drop-down list, the user should now be displayed
all the records that Author1 has written BUT which have been published
by Publisher1 only. Now Author1 has written 10 books. Out of these 10
books, Publisher1 has published 4 books. So under such circumstances, 4
records should be retrieved & displayed to the user. The SQL query
would be
SELECT * FROM tblBooks WHERE Author='Author1' AND
Publisher='Publisher1'
The problem I am having is in adding the second WHERE clause i.e. 'AND
Publisher='Publisher1' in the SELECT query. Please note that all the
drop-down lists EXCEPT for the author drop-down list should change
again & contain only those records as options which are common to both
Author1 & Publisher1.
Arpan> The problem I am having is in adding the second WHERE clause i.e. 'AND
> Publisher='Publisher1' in the SELECT query.
So what is the problem? That query is syntactically valid so it isn't
obvious what your question is.
I would have expected separate tables for publisher and books joined by
a third table for the many-to-many relationship. Is it the join that
you have a problem with? For example:
SELECT ...
FROM tblBooks AS B
JOIN tblBookPublishers AS J
ON B.isbn = J.isbn
JOIN tblPublishers AS P
ON J.publisher_id = P.publisher_id
WHERE B.Author='Author1'
AND P.Publisher='Publisher1' ;
And by the way, books can have more than one author too, so author
probably shouldn't appear in the books table and you need at least two
more tables there.
If you need more help, please read this first:
http://www.aspfaq.com/etiquette.asp?id=5006
David Portas
SQL Server MVP
--|||I do understand that your are right in saying that the records should
have been in seperate tables but the fact is the database that my
clients have wasn't created by a database expert; so they have all the
records in one table only & don't wish to seperate the records in
different tables because of time constraint.
Had related records been in different tables, there wouldn't have been
any problem but since that isn't the case, my problems have increased.
Any further suggestions?|||> Any further suggestions?
What is your question?
Please also include a CREATE TABLE statement if your question is about
a query.
David Portas
SQL Server MVP
--

Dynamic SQL or CASE statement?

hi all,
we are having an asp app that is fetching a big resultset to display in a
list screen. The screen has 4 or 5 columns which have the click sort option
(ie., on clicking the column hdr, the list needs to be sorted out).
Currently, we are using a procedure which would dynamically construct the
sort order and use exec(@.stmt) to send back the resultset. Coz of perf issue
s
of late, we are thinking of removing dyn sql in the proc and recreating it
using CASE/IF statements. Which option would be better in general? Currently
,
the dyn sql has high counts of CPU.
would appreciate any help in this regards
thx
paraaWhy sort it at all? Can't ASP handle that? It would be more scalable than
making SQL Server do all the sorting.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"paraa" <paraa@.discussions.microsoft.com> wrote in message
news:6D3D38EC-AAB8-4BF0-A74F-AAE898D73BBD@.microsoft.com...
hi all,
we are having an asp app that is fetching a big resultset to display in a
list screen. The screen has 4 or 5 columns which have the click sort option
(ie., on clicking the column hdr, the list needs to be sorted out).
Currently, we are using a procedure which would dynamically construct the
sort order and use exec(@.stmt) to send back the resultset. Coz of perf
issues
of late, we are thinking of removing dyn sql in the proc and recreating it
using CASE/IF statements. Which option would be better in general?
Currently,
the dyn sql has high counts of CPU.
would appreciate any help in this regards
thx
paraa|||tom,
we have lean clients and so after lot of brainstorming have put the sorting
on the server side..sorting on client is not an option over here..as per the
scalability factor - may not be that much of an issue..thatz why we are
thinking abt using CASE on the proc side...wanted to know if that would buy
us something vis a vis dyn sql
thx
"Tom Moreau" wrote:

> Why sort it at all? Can't ASP handle that? It would be more scalable tha
n
> making SQL Server do all the sorting.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> ..
> "paraa" <paraa@.discussions.microsoft.com> wrote in message
> news:6D3D38EC-AAB8-4BF0-A74F-AAE898D73BBD@.microsoft.com...
> hi all,
> we are having an asp app that is fetching a big resultset to display in a
> list screen. The screen has 4 or 5 columns which have the click sort optio
n
> (ie., on clicking the column hdr, the list needs to be sorted out).
> Currently, we are using a procedure which would dynamically construct the
> sort order and use exec(@.stmt) to send back the resultset. Coz of perf
> issues
> of late, we are thinking of removing dyn sql in the proc and recreating it
> using CASE/IF statements. Which option would be better in general?
> Currently,
> the dyn sql has high counts of CPU.
> would appreciate any help in this regards
> thx
> paraa
>|||How "lean" are we talking? I find it hard to believe that an IIS server
can't handle this.
That said, you can do dynamic sorting without resorting to dynamic SQL:
declare @.sort varchar (100)
set @.sort = 'Country'
select
*
from
dbo.Customers
order by
case when @.sort = 'Country' then Country end
, case when @.sort = 'CustomerID' then CustomerID end
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"paraa" <paraa@.discussions.microsoft.com> wrote in message
news:C3B84B96-3839-4A66-8FAE-0F737FBE21C5@.microsoft.com...
tom,
we have lean clients and so after lot of brainstorming have put the sorting
on the server side..sorting on client is not an option over here..as per the
scalability factor - may not be that much of an issue..thatz why we are
thinking abt using CASE on the proc side...wanted to know if that would buy
us something vis a vis dyn sql
thx
"Tom Moreau" wrote:

> Why sort it at all? Can't ASP handle that? It would be more scalable
> than
> making SQL Server do all the sorting.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> ..
> "paraa" <paraa@.discussions.microsoft.com> wrote in message
> news:6D3D38EC-AAB8-4BF0-A74F-AAE898D73BBD@.microsoft.com...
> hi all,
> we are having an asp app that is fetching a big resultset to display in a
> list screen. The screen has 4 or 5 columns which have the click sort
> option
> (ie., on clicking the column hdr, the list needs to be sorted out).
> Currently, we are using a procedure which would dynamically construct the
> sort order and use exec(@.stmt) to send back the resultset. Coz of perf
> issues
> of late, we are thinking of removing dyn sql in the proc and recreating it
> using CASE/IF statements. Which option would be better in general?
> Currently,
> the dyn sql has high counts of CPU.
> would appreciate any help in this regards
> thx
> paraa
>|||If you simply need to sort by a single column, then the ASP.NET DataGrid
could handle this. However, if your sort requirements are more complex
involving multiple columns or complex conditions, then it would probably
need to be done within the stored procedure. A conditional [order by] clause
using a case expression would be much preferable than dynamic SQL. Just as a
side note, you can also include case expressions in the [where] clause as
well for conditional row filtering, or even in the [group by] clause for
conditional grouping.
In the example below, there are 3 different sort options enabled using a
parameter called @.sort :
. . .
order by
case @.sort
when 0 then NULL
when 1 then company
when 2 then region
end,
case @.sort
when 0 then accountno
when 1 then lastname
when 2 then lastname
end
"paraa" <paraa@.discussions.microsoft.com> wrote in message
news:6D3D38EC-AAB8-4BF0-A74F-AAE898D73BBD@.microsoft.com...
> hi all,
> we are having an asp app that is fetching a big resultset to display in a
> list screen. The screen has 4 or 5 columns which have the click sort
> option
> (ie., on clicking the column hdr, the list needs to be sorted out).
> Currently, we are using a procedure which would dynamically construct the
> sort order and use exec(@.stmt) to send back the resultset. Coz of perf
> issues
> of late, we are thinking of removing dyn sql in the proc and recreating it
> using CASE/IF statements. Which option would be better in general?
> Currently,
> the dyn sql has high counts of CPU.
> would appreciate any help in this regards
> thx
> paraa|||thx a bunch JT and tom..thatz what i was arriving at when i mentioned CASE
stmt v/s dyn sql...just wanted to make sure with the xperts
"JT" wrote:

> If you simply need to sort by a single column, then the ASP.NET DataGrid
> could handle this. However, if your sort requirements are more complex
> involving multiple columns or complex conditions, then it would probably
> need to be done within the stored procedure. A conditional [order by] clau
se
> using a case expression would be much preferable than dynamic SQL. Just as
a
> side note, you can also include case expressions in the [where] clause as
> well for conditional row filtering, or even in the [group by] clause for
> conditional grouping.
> In the example below, there are 3 different sort options enabled using a
> parameter called @.sort :
> .. . .
> order by
> case @.sort
> when 0 then NULL
> when 1 then company
> when 2 then region
> end,
> case @.sort
> when 0 then accountno
> when 1 then lastname
> when 2 then lastname
> end
> "paraa" <paraa@.discussions.microsoft.com> wrote in message
> news:6D3D38EC-AAB8-4BF0-A74F-AAE898D73BBD@.microsoft.com...
>
>