Showing posts with label page. Show all posts
Showing posts with label page. Show all posts

Friday, March 30, 2012

pop up requirement

how do we click on anything within the reports, pass the parameters to another reports and also make the drill thru report open in a new page

See this page for information on Report Interactivity, including jumping to other Reports or Urls, http://msdn2.microsoft.com/en-us/library/ms345258(sql.90).aspx

If you need to have the report open in a new window, then you will need to use the Jump to Url method using javascript, like the following,

=void(window.open('" & Globals!ReportServerUrl & "?/ReportName&rs:Command=Render&rs:Format=Html4.0&Parameter1=" & Fields!Field1.Value & "','_blank'))"

Monday, March 26, 2012

Polish characters problem.

Hi,
First off all I am not SQL expert so pls forgive me if something will be
unclear.
I have old SQL 7.0 with Code page CP1252 and database application on it with
polish characters.
I migrated to SQL 2000 with Server collation Latin1_General_CI_AS (also on
database) and my application do not see polish characters.
Any idea?
Artur
Hi
If you had code page 1250 then I would expect a Polish collation to be used.
Extended data would be lost if you switched from 1250 to 1252. Therefore you
may want to try a Polish collation for the destination database.
How did you convert the database?
John
"arti" <artipp@.op.pl> wrote in message news:cll8au$odf$1@.news.onet.pl...
> Hi,
> First off all I am not SQL expert so pls forgive me if something will be
> unclear.
>
> I have old SQL 7.0 with Code page CP1252 and database application on it
with
> polish characters.
> I migrated to SQL 2000 with Server collation Latin1_General_CI_AS (also on
> database) and my application do not see polish characters.
> Any idea?
>
> Artur
>

Polish characters problem.

Hi,
First off all I am not SQL expert so pls forgive me if something will be
unclear.
I have old SQL 7.0 with Code page CP1252 and database application on it with
polish characters.
I migrated to SQL 2000 with Server collation Latin1_General_CI_AS (also on
database) and my application do not see polish characters.
Any idea?
ArturHi
If you had code page 1250 then I would expect a Polish collation to be used.
Extended data would be lost if you switched from 1250 to 1252. Therefore you
may want to try a Polish collation for the destination database.
How did you convert the database?
John
"arti" <artipp@.op.pl> wrote in message news:cll8au$odf$1@.news.onet.pl...
> Hi,
> First off all I am not SQL expert so pls forgive me if something will be
> unclear.
>
> I have old SQL 7.0 with Code page CP1252 and database application on it
with
> polish characters.
> I migrated to SQL 2000 with Server collation Latin1_General_CI_AS (also on
> database) and my application do not see polish characters.
> Any idea?
>
> Artur
>sql

Polish characters problem.

Hi,
First off all I am not SQL expert so pls forgive me if something will be
unclear.
I have old SQL 7.0 with Code page CP1252 and database application on it with
polish characters.
I migrated to SQL 2000 with Server collation Latin1_General_CI_AS (also on
database) and my application do not see polish characters.
Any idea?
ArturHi
If you had code page 1250 then I would expect a Polish collation to be used.
Extended data would be lost if you switched from 1250 to 1252. Therefore you
may want to try a Polish collation for the destination database.
How did you convert the database?
John
"arti" <artipp@.op.pl> wrote in message news:cll8au$odf$1@.news.onet.pl...
> Hi,
> First off all I am not SQL expert so pls forgive me if something will be
> unclear.
>
> I have old SQL 7.0 with Code page CP1252 and database application on it
with
> polish characters.
> I migrated to SQL 2000 with Server collation Latin1_General_CI_AS (also on
> database) and my application do not see polish characters.
> Any idea?
>
> Artur
>

Wednesday, March 21, 2012

PLZZ HELP ! ERROR CONNECTING TO SQL SERVER

Hello everybody

i am getting problem in connecting my asp.net(c#) web application with Sql Server 2000 programatically on the page load of my web form

I wrote following code in the page load

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page
SqlConnection myConnection = new SqlConnection("server=(local);database=master;Integrated Security=SSPI");
SqlDataAdapter myCommand = new SqlDataAdapter("select * from emp", myConnection);

DataSet ds = new DataSet();
myCommand.Fill(ds, "emp");

DataGrid1.DataSource=ds.Tables["emp"].DefaultView;
DataGrid1.DataBind();
}

Build OK but following exception occurred:

Server Error in '/datagridtest' Application.
------------------------

Login failed for user 'MATRIX\ASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'MATRIX\ASPNET'.

Source Error:

Line 27:
Line 28: DataSet ds = new DataSet();
Line 29: myCommand.Fill(ds, "emp"); //THIS APPEARS IN RED ON THE PAGE
Line 30:
Line 31: DataGrid1.DataSource=ds.Tables["emp"].DefaultView;

----------------------------
PLZ HELP ME, I THINK THE PROBLEM IS WITH CONNECTIONSTRING, I STUCK UP HERE FROM LAST 3 DAYS AND COULD NOT PROCEED WITH MY FURTHER STUDY AND PRACTICE

THANX IN ADVANCE

BSSGlad you got this worked out!view post 806235

Monday, March 12, 2012

pls help.......very urgent....

is there any possible way to have a page break each time a text field from the report changes.

i am using CR 8.5 and VB6

if possible can anyone who has the answer pls contact on msn mesenger....
amit_mash@.hotmail.com

PS: i am attaching a report i generated. i want to have a page break each time the value of the text field containing 'Blood Routine (CBC)' changes.The field you want to page break on first must be part of a sort group. Then the group header and footer will appear. In Format Section select the group and check page break before or after as needed.

Pls help me with this SQL CASE WHEN (on ASP)

Hi and thanx for reading my post..

Well.. my problem is that i cannot seem to get the CASE syntax correct within my ASP page. I'm not sure where to break the lines and all that.

I have searched the net for quiiite a while before posting this :)

Will be VERY glad if someone can help me to put the puzzle in the right ASP-way :)

-----START-----
strSQL = "SELECT enavn,fnavn,fodselsnr,fangenr,convert(char(10),reg _date,104) " &_

"'status'= CASE when legal = '1' then "beginner" when legal = '2' then "intermediate" when legal = '3' then "professional" when kan_skal = 'kan' then "darlig foto" else 'status ikke angitt' END " &_

"FROM BILDE WHERE accepted LIKE " & "'1'" & " AND marked LIKE " & "'0'" & " AND pkode LIKE " & strDistrikt & " AND kan_skal LIKE " & "'kan'" & " AND arstall LIKE " & strArstall
-----END------

What i want to do is getting the three values from the SQL DB which are in the "legal" field (1, 2 or 3), and based on what it is display "beginner", "intermediate", "professional" or "darlig foto".

Best regards
Miradoryou have single quotes around status -- remove those

i prefer the as alias syntax instead of the alias = syntax

you have doublequotes around some strings ("beginner") which should be singlequotesselect enavn,fnavn,fodselsnr,fangenr
, convert(char(10),reg_date,104)
, case when legal = '1' then 'beginner'
when legal = '2' then 'intermediate'
when legal = '3' then 'professional'
when kan_skal = 'kan' then 'darlig foto'
else 'status ikke angitt'
end as status
from bilde
where ...also, none of your LIKE strings appear to have wildcards in them|||What language are you using here? What server? I suspect you're terminating your string improperly.

edit: r937 beat me to it.|||Programming in ASP, SQL towards MS SQL.
Tnx for the hints ppl...

I'm not very good at SQL... yet.. could anyone correct my code so that it might work ? thinking about where i should use double-qoutes in the start of lines and where i should use " &_

Mirador

Originally posted by Teddy
What language are you using here? What server? I suspect you're terminating your string improperly.

edit: r937 beat me to it.|||Tnx !!...

Hmm.. btw: what do u mean by Wildcards on the "LIKE"'s ?`

Mir..

Originally posted by r937
you have single quotes around status -- remove those

i prefer the as alias syntax instead of the alias = syntax

you have doublequotes around some strings ("beginner") which should be singlequotesselect enavn,fnavn,fodselsnr,fangenr
, convert(char(10),reg_date,104)
, case when legal = '1' then 'beginner'
when legal = '2' then 'intermediate'
when legal = '3' then 'professional'
when kan_skal = 'kan' then 'darlig foto'
else 'status ikke angitt'
end as status
from bilde
where ...also, none of your LIKE strings appear to have wildcards in them|||Wildcards can differ per application, but in SQL Server an example of a wild card in a like statement would be as follows:

Select legal
from bilde
where accepted like '%&%' (in this case the % are the wild cards).

This would find all records of [legal] from the table [bilde] where the amperstand (&) appears somewhere in the field [accepted].

Originally posted by Mirador
Tnx !!...

Hmm.. btw: what do u mean by Wildcards on the "LIKE"'s ?`

Mir..

Pls help me

Hi
I had windows integrated authication in directory
security in both folder reports and reportserver.
But I need reportserver as normal asp page so I just
changed to allow annoynymus access to reportserver folder.
So any once can access report using specifi url and it's
working without any problem.
But funny part is when I access
http://servername/reports (and logged in as administrator)
It doesnt show anything. Before that It was showing my
report and I could change and configure my report.
Please note that I didnt change any security setting in
reports folder and only thing I changed was allowing
annoynymus access to reporserver folder.
Any help would be grateful
Thanx
KenWhen you configure the Report Server for anonymous access, it will see the
requests coming under the anonymous account (IUSR_<computer name>) which
most likely doesn't have access to the report catalog in your case.
I would recommend you reconsider the Anonymous access strategy. When
Anonymous access is enabled, the Report Server won't be able to
differentiate the users which IMO is a recipe for a total chaos.
Not sure what you mean by I need reportserver as normal asp page.
Hope this helps.
---
Teo Lachev, MCSD, MCT
Author: "Microsoft Reporting Services in Action"
www.manning.com/lachev
"Ken" <anonymous@.discussions.microsoft.com> wrote in message
news:212b601c45a4c$15af4980$a101280a@.phx.gbl...
> Hi
> I had windows integrated authication in directory
> security in both folder reports and reportserver.
> But I need reportserver as normal asp page so I just
> changed to allow annoynymus access to reportserver folder.
> So any once can access report using specifi url and it's
> working without any problem.
> But funny part is when I access
> http://servername/reports (and logged in as administrator)
> It doesnt show anything. Before that It was showing my
> report and I could change and configure my report.
> Please note that I didnt change any security setting in
> reports folder and only thing I changed was allowing
> annoynymus access to reporserver folder.
> Any help would be grateful
> Thanx
> Ken
>

Friday, March 9, 2012

pls advise me. HELP pls...

on the 1st opening of my web page it uses the membership control of asp.net
for logging on. sometimes it takes time to logon and worse is, it will
encounter sql server error. that can be resolved by just restarting that
specific page and it will be alright, it will logon normally. this only issue happens only on the first opening of the logon page.

i have read a certain article and it says there that on the first time
you access the sql server, sometimes the sql server needs a little more
time communicating back and forth.

how can i make my log-on page wait a little longer till it communicates
or finishes communicating to the sql server?

im afraid that this may happen once i deploy my web project. i am
expecting over 100 users and they might save to the database all
together. will i encounter problem on this particular?

i am using ASP.NET 2.0 and SQLExpress for this project. pls advise me.
BIG THANKS.

Hi,

what sort of error do you get ? If you are getting a commandTimeout error you can set the commandTimeout property in your application a bit higher to achieve that the command can have a bit more time to execute.

HTH;, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

Jens Suessmeyer wrote:

Hi,

what sort of error do you get ? If you are getting a commandTimeout error you can set the commandTimeout property in your application a bit higher to achieve that the command can have a bit more time to execute.

HTH;, Jens Suessmeyer.

http://www.sqlserver2005.de

thanks Jens. that is exactly what i need. thanks a lot man!
|||just a question....

my web project is using SQL Express2005 and ASP.NET and C#.
my web hosting company only have MSsql2000. would there beany conflict with regards to my database? im sorry if i sound dumb. im a newbie to this.
thanks
|||Hi,

if you hosting company only supports MSDE or MSSQL 2000, I would not use SQL Server Express as a basis of development. I would rather use 2000, because you won't have any problem transfering the database from your development pc to the hosting company.

HTH, jens Suessmeyer.

http://www.sqlserver2005.de
|||i am only using one mdf file and my asp.net program just deals with the common add, edit, delete transactions. would these transactions differ from version to version of MSSQL?

honestly i did not think there would be a problem coz these transactions are very common. pls correct me if i am wrong.
|||No, you are sure right, but as of my experiences as a developer I would rather rely on the same system (even on the same SP level) than using a more sophisticated version of the database. But you are right that in case you don`t use any other stuff like doing standard DML there should be no problem.

HTH, Jens Suessmeyer.

http://www.sqlsever2005.de
--|||i just installed MSDE. i tried attaching my mdf file (created by SQL Express) to the MSDE but i got this error message:

"An error occured when attaching the database"

i attached that mdf file to the SQL Express and i encountered no problem at all. is this the problem you are talking abt Jens? do you think i will encounter the same problem with my hosting company?

thanks a lot for your time Jens.
|||SQL Express datafile have a different storage structure than the SQL2k files. YOu can't do that. If you want transfer the database to the SQL2k you have to do scripting of the objects to transfer the data to the prior SQL2k5 databases.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de
|||can I implement the membership control (provided by ASP.NET) on MSDE? i can try migrating from SQLEXxpress to MSDE but im not sure if membership control works on that MSDE. sorry if i really sound dumb. im a newbie.
|||

Hi,

habe a look here:

http://aspnet.4guysfromrolla.com/articles/120705-1.aspx

"Use the ASP.NET SQL Server Registration Tool (aspnet_regsql.exe) command-line tool (use this tool to implement the schema in a SQL Server 2000 or 2005 database) "

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

Please....tell me can it be done or not?

Can I set a URL in such a way that as soon as a report opens; it takes us to
a specified aspx page first?I'm not aware of any way to do this. What is it you are trying to
accomplish? Maybe there is some other way to do it.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"RA" <rchaudhary-nospam@.storis.com> wrote in message
news:%23to4cyOzEHA.2568@.TK2MSFTNGP10.phx.gbl...
> Can I set a URL in such a way that as soon as a report opens; it takes us
to
> a specified aspx page first?
>|||If your goal is to authenticate the user, you can check out the Forms
Authentication example available from Microsoft. That auto-redirects users
who are not authenticated.
--
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:e%23MQX1OzEHA.908@.TK2MSFTNGP11.phx.gbl...
> I'm not aware of any way to do this. What is it you are trying to
> accomplish? Maybe there is some other way to do it.
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "RA" <rchaudhary-nospam@.storis.com> wrote in message
> news:%23to4cyOzEHA.2568@.TK2MSFTNGP10.phx.gbl...
>> Can I set a URL in such a way that as soon as a report opens; it takes us
> to
>> a specified aspx page first?
>>
>|||Just like clicking a link, we can open a report; I want to open an html or
aspx page.
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:e%23MQX1OzEHA.908@.TK2MSFTNGP11.phx.gbl...
> I'm not aware of any way to do this. What is it you are trying to
> accomplish? Maybe there is some other way to do it.
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "RA" <rchaudhary-nospam@.storis.com> wrote in message
> news:%23to4cyOzEHA.2568@.TK2MSFTNGP10.phx.gbl...
>> Can I set a URL in such a way that as soon as a report opens; it takes us
> to
>> a specified aspx page first?
>>
>|||I still don't understand what you are trying to accomplish.
If you want to integrate an existing webpage then look at URL integration.
If you want to go from some report to a web page of your choosing then you
can do a jump to URL and go anywhere you want. It does not have to be a
report.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"RA" <rchaudhary-nospam@.storis.com> wrote in message
news:utTuZ3OzEHA.3548@.TK2MSFTNGP09.phx.gbl...
> Just like clicking a link, we can open a report; I want to open an html or
> aspx page.
> "Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
> news:e%23MQX1OzEHA.908@.TK2MSFTNGP11.phx.gbl...
> > I'm not aware of any way to do this. What is it you are trying to
> > accomplish? Maybe there is some other way to do it.
> >
> > --
> > Bruce Loehle-Conger
> > MVP SQL Server Reporting Services
> >
> > "RA" <rchaudhary-nospam@.storis.com> wrote in message
> > news:%23to4cyOzEHA.2568@.TK2MSFTNGP10.phx.gbl...
> >> Can I set a URL in such a way that as soon as a report opens; it takes
us
> > to
> >> a specified aspx page first?
> >>
> >>
> >
> >
>|||Try IIS "redirect" feature but don't know if it will work.
"RA" wrote:
> Can I set a URL in such a way that as soon as a report opens; it takes us to
> a specified aspx page first?
>
>|||Using Jump to URL, can a web page be opened in new window?
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:OgYaw7OzEHA.1400@.TK2MSFTNGP11.phx.gbl...
>I still don't understand what you are trying to accomplish.
> If you want to integrate an existing webpage then look at URL integration.
> If you want to go from some report to a web page of your choosing then you
> can do a jump to URL and go anywhere you want. It does not have to be a
> report.
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "RA" <rchaudhary-nospam@.storis.com> wrote in message
> news:utTuZ3OzEHA.3548@.TK2MSFTNGP09.phx.gbl...
>> Just like clicking a link, we can open a report; I want to open an html
>> or
>> aspx page.
>> "Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
>> news:e%23MQX1OzEHA.908@.TK2MSFTNGP11.phx.gbl...
>> > I'm not aware of any way to do this. What is it you are trying to
>> > accomplish? Maybe there is some other way to do it.
>> >
>> > --
>> > Bruce Loehle-Conger
>> > MVP SQL Server Reporting Services
>> >
>> > "RA" <rchaudhary-nospam@.storis.com> wrote in message
>> > news:%23to4cyOzEHA.2568@.TK2MSFTNGP10.phx.gbl...
>> >> Can I set a URL in such a way that as soon as a report opens; it takes
> us
>> > to
>> >> a specified aspx page first?
>> >>
>> >>
>> >
>> >
>>
>|||A report is not a web page. RS is a web application that retrieves the
appropriate RDL from the database, renders it and returns the data. I really
don't think that would work.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"mresanchez" <mresanchez@.donot-spam.com> wrote in message
news:F3CEA3E9-CDB9-4ABF-930B-BC2771B4CD07@.microsoft.com...
> Try IIS "redirect" feature but don't know if it will work.
>
> "RA" wrote:
> > Can I set a URL in such a way that as soon as a report opens; it takes
us to
> > a specified aspx page first?
> >
> >
> >|||Teo (the other MVP) just answered this in another thread. I didn't know the
answer but saw his.
= "javascript:window.open('http://www.google.com')"
Cool.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"RA" <rchaudhary-nospam@.storis.com> wrote in message
news:OxqmrJPzEHA.2716@.TK2MSFTNGP14.phx.gbl...
> Using Jump to URL, can a web page be opened in new window?
> "Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
> news:OgYaw7OzEHA.1400@.TK2MSFTNGP11.phx.gbl...
>>I still don't understand what you are trying to accomplish.
>> If you want to integrate an existing webpage then look at URL
>> integration.
>> If you want to go from some report to a web page of your choosing then
>> you
>> can do a jump to URL and go anywhere you want. It does not have to be a
>> report.
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "RA" <rchaudhary-nospam@.storis.com> wrote in message
>> news:utTuZ3OzEHA.3548@.TK2MSFTNGP09.phx.gbl...
>> Just like clicking a link, we can open a report; I want to open an html
>> or
>> aspx page.
>> "Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
>> news:e%23MQX1OzEHA.908@.TK2MSFTNGP11.phx.gbl...
>> > I'm not aware of any way to do this. What is it you are trying to
>> > accomplish? Maybe there is some other way to do it.
>> >
>> > --
>> > Bruce Loehle-Conger
>> > MVP SQL Server Reporting Services
>> >
>> > "RA" <rchaudhary-nospam@.storis.com> wrote in message
>> > news:%23to4cyOzEHA.2568@.TK2MSFTNGP10.phx.gbl...
>> >> Can I set a URL in such a way that as soon as a report opens; it
>> >> takes
>> us
>> > to
>> >> a specified aspx page first?
>> >>
>> >>
>> >
>> >
>>
>>
>|||You could always build a web application that did whatever you want and then
ran a report.
--
Brian Welcker
Group Program Manager
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:%237FEZLPzEHA.2656@.TK2MSFTNGP14.phx.gbl...
>A report is not a web page. RS is a web application that retrieves the
> appropriate RDL from the database, renders it and returns the data. I
> really
> don't think that would work.
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "mresanchez" <mresanchez@.donot-spam.com> wrote in message
> news:F3CEA3E9-CDB9-4ABF-930B-BC2771B4CD07@.microsoft.com...
>> Try IIS "redirect" feature but don't know if it will work.
>>
>> "RA" wrote:
>> > Can I set a URL in such a way that as soon as a report opens; it takes
> us to
>> > a specified aspx page first?
>> >
>> >
>> >
>

PLEASE! - Login failed for user MACHINENAME\ASPNET.

Help!! I am using Sql Server 2005 Express.

I am trying to connect to it from an aspx page.

I get the error:

Cannot open user default database. Login failed.
Login failed for user 'MACHINENAME\ASPNET'.

I have added MACHINENAME\ASPNET as a user to the database I am trying to connect to using SQL Server Management Studio Express.

Why wont it let me connect?

Any help on the matter would be most welcome.

Thanks you.

Hi,
I use sql server 2000 but I had th same problem a few months ago. You should examine 2 options. First look at the groups in your windows not on the sql server and see if aspnet and guest accounts are enabled or disabled. If they are disabled pls make them enabled then delete the available aspnet account in your sql. Create again an aspnet account in your sql choosing available accounts in your windows account, dont create aspnet account by typing aspnet yourself. just choose. Finally as you know, give this account necessary permissions you need to do your work in your database. I hope this will solve the problem :)

The Ghost of PC
[ Peace in country, peace in the world]

|||

Cannot open user default database

The user you set up does not have permissions on the database you set as the users default database.

|||

ghost,

I'm a real newbie. How do I look at groups in my windows? I have the same problem, only with some databases and not others.

dennist685

|||No offense but I kind of guessed that! If you see my message you'll see that I already added the user so that wasn't the problem.

I actually changed the way I connected to the database to:

Data Source=.\SQLEXPRESS;Initial Catalog=myDb;Integrated Security=True;

previously I was using:

Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|myDb.mdf

Now, here's the wiered thing. If I connect using the top method, it works and I'm connecting as machinename/ASPNET.

If I use the second connection string, I'm still connecting as machinename/ASPNET but the login fails.

So, if anyone can explain that, I'd be interested to know why it happens. I've set up machinename/ASPNET as a user so that ISN'T the problem as it lets me connect using the top connection string. It seems to be when I use the bottom method for connecting that I get the error even though I know that machinname/ASPNET is set up as a user on the database.

Wednesday, March 7, 2012

Please someone out there has to know... I am going crazy

ok I will post no code this time. I need help I have tried a half of dozen methods and they all only work half way. I need to create a search page that searches on all keywords in a textbox. I have tried split functions, like commands, freetext catalogs.

I want to go with the free text search.

How?

Has anyone used a freetext search in asp or c#? please post some code I re arrange it or let me know how to pass the freetext search param to the sql server....

Please....

The detailed explanation of the Full text feature of SQL Server is out of the scope of this post. Visit below links to understand the feature and how to implement it.

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

http://technet.microsoft.com/en-us/sqlserver/bb331773.aspx

http://www.eggheadcafe.com/articles/20010422.asp

http://www.sql-server-performance.com/articles/all/tb_search_optimization_p1.aspx

Some links are for SQL 2000 and some for SQL 2005. Feel free to ask any queries on this feature if you've any doubts after studying the concept.

Hope this will help.

|||

http://forums.asp.net/p/801329/803263.aspx

Look at aptbid's third post in the thread. His SP splits the words in the searchterm and then returns ranked results based on the position of the search term in the fields searched. Obviously you will need to adapt the table and field names to your environment.

|||

the problem was that sql server 2005 does not like to auto populate I had to turn change tracking to off the do a incremental population this worked happens on two different machine.

please provide me some resources

Where I can read up on the best way to provide a data view of SQL 2000 data
for a web page.
My Part in this is to provide a mean for the web guy to read an inventory
list from the database and then he will set that up on the web page... I
feel like such a rookie... I would really appreciate any links or info
that can be provided... Thanks
Hi
"WANNABE" wrote:

> Where I can read up on the best way to provide a data view of SQL 2000 data
> for a web page.
> My Part in this is to provide a mean for the web guy to read an inventory
> list from the database and then he will set that up on the web page... I
> feel like such a rookie... I would really appreciate any links or info
> that can be provided... Thanks
>
This will depend on what you want to write the web page in! For instance if
it is going to be in ASP.NET try starting at
http://classicasp.aspfaq.com/general/where-can-i-find-out-about-net.html or
for classic ASP try
http://classicasp.aspfaq.com/general/how-do-i-use-asp-to.html
John
|||Thanks John, The web page will be hosted on a Linux box, I think ?pearl? or
?apache?, these things are said with little familiarity to the Linux and web
area. Does that change things much ?
There is much of this that I really don't understand well and I don't expect
anyone to explain it to me but if you can point me in the right direction as
to where to read / learn. A consultant on the outside will access our
network through a DMZ Linux box. So he will not have any domain rights. I
need to provide something (I've created a view) so he can retrieve data to
be viewed from the web site. This should be real-time data. I think this
can be done with the view I created and by creating a SQL login with rights
only to read the view. Is this Right? Am I on the right track or way
off?
=================================================
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:522F2747-B3A8-4C43-B025-1C3DD20C2E97@.microsoft.com...
> Hi
> "WANNABE" wrote:
> This will depend on what you want to write the web page in! For instance
> if
> it is going to be in ASP.NET try starting at
> http://classicasp.aspfaq.com/general/where-can-i-find-out-about-net.html
> or
> for classic ASP try
> http://classicasp.aspfaq.com/general/how-do-i-use-asp-to.html
> John
>
|||Hi
"WANNABE" wrote:

> Thanks John, The web page will be hosted on a Linux box, I think ?pearl? or
> ?apache?, these things are said with little familiarity to the Linux and web
> area. Does that change things much ?
Although I think there may be something that supports ASP on linux, you may
want to go the JSP/javabeans route. Microsoft do have a JDBC driver for SQL
Server. One thing you will need to consider is how the system will be
maintained and how much that will cost after initial development. I don't
know of any specific website for this, but if you search for them using
Google and/or buy yourself a good book you should be ok.

> There is much of this that I really don't understand well and I don't expect
> anyone to explain it to me but if you can point me in the right direction as
> to where to read / learn. A consultant on the outside will access our
> network through a DMZ Linux box. So he will not have any domain rights. I
> need to provide something (I've created a view) so he can retrieve data to
> be viewed from the web site. This should be real-time data. I think this
> can be done with the view I created and by creating a SQL login with rights
> only to read the view. Is this Right? Am I on the right track or way
> off?
The user associated to the SQL Login, will require SELECT privileges on the
view. If you have set that up then you should be ok. Check what groups this
user is in to make sure that he does not have extra privileges through group
membership.
John
|||WANNABE wrote:
> Thanks John, The web page will be hosted on a Linux box, I think ?pearl? or
> ?apache?, these things are said with little familiarity to the Linux and web
> area. Does that change things much ?
> There is much of this that I really don't understand well and I don't expect
> anyone to explain it to me but if you can point me in the right direction as
> to where to read / learn. A consultant on the outside will access our
> network through a DMZ Linux box. So he will not have any domain rights. I
> need to provide something (I've created a view) so he can retrieve data to
> be viewed from the web site. This should be real-time data. I think this
> can be done with the view I created and by creating a SQL login with rights
> only to read the view. Is this Right? Am I on the right track or way
> off?
>
You're going to need something to allow the Linux box to talk to SQL
Server. Look up FreeTDS, I've used this in the past to connect PHP
pages to SQL Server. Assuming that's in place, you simply need to
create a SQL login that has the necessary rights, and the web pages will
use that login to execute queries against your database. I would
suggest creating stored procedures instead of embedded queries, it will
be easier for YOU to debug and optimize.
Tracy McKibben
MCDBA
http://www.realsqlguy.com
|||Thanks Tracy, You suggested "creating stored procedures instead of embedded
queries" and I'm just guessing, are views considered embedded queries? Now
I am still in training for my MCDBA, but I thought that a view was much like
a stored procedure in that it is executed at the server, but it would
provide the most a display of the most current data in an efficient manner.
I hope I don't sound stupid, but if I do please let me know.
I'm sure there are key differences between SPs and Views, but I'm not sure I
know what they are..
==============================================
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45A3B567.7000903@.realsqlguy.com...
> WANNABE wrote:
> You're going to need something to allow the Linux box to talk to SQL
> Server. Look up FreeTDS, I've used this in the past to connect PHP pages
> to SQL Server. Assuming that's in place, you simply need to create a SQL
> login that has the necessary rights, and the web pages will use that login
> to execute queries against your database. I would suggest creating stored
> procedures instead of embedded queries, it will be easier for YOU to debug
> and optimize.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
|||WANNABE wrote:
> Thanks Tracy, You suggested "creating stored procedures instead of embedded
> queries" and I'm just guessing, are views considered embedded queries? Now
> I am still in training for my MCDBA, but I thought that a view was much like
> a stored procedure in that it is executed at the server, but it would
> provide the most a display of the most current data in an efficient manner.
> I hope I don't sound stupid, but if I do please let me know.
> I'm sure there are key differences between SPs and Views, but I'm not sure I
> know what they are..
Every query is executed "at the server". A view is nothing more than a
virtual table that can be used to simplify a complex query. A stored
procedure is a pre-compiled collection of one or more queries.
Assume that you have three tables containing related information. Each
time your web page needs data from these tables, they must be joined
together. Your options for obtaining that data are:
1. Embedded query
The web page directly issues the following query:
SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
FROM t1
INNER JOIN t2
ON t1.key = t2.key
INNER JOIN t3
ON t2.key = t3.key
2. View
The view is defined as:
CREATE VIEW MyView
AS
SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
FROM t1
INNER JOIN t2
ON t1.key = t2.key
INNER JOIN t3
ON t2.key = t3.key
The web page issues this query:
SELECT col1, col2, col3
FROM MyView
3. Stored Procedure
The sproc is defined as:
CREATE PROCEDURE MySproc
AS
SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
FROM t1
INNER JOIN t2
ON t1.key = t2.key
INNER JOIN t3
ON t2.key = t3.key
The web page issues this query:
EXEC MySproc
All three return the same results, and in all three cases, the "work" is
done on the server. Now, let's assume that a fourth table is created,
and this fourth table needs to become part of this join. Option #1 will
require you to modify the web page to include the new table. Both
options #2 and #3 allow you to add the table without modifying the query
in the web page. This is a simple example, however, and more than
likely you'll need to modify the web page to accept new columns returned
from the new table.
The real beauty of using Option #3 is in performance tuning. By using a
stored proc, you have the flexibility of experimenting with temp tables,
subqueries, etc. to optimize performance, without the need to modify the
web page. There are additional security benefits to using stored procs
as well, because you don't have to grant permissions directly to the tables.
Tracy McKibben
MCDBA
http://www.realsqlguy.com
|||THAT IS A GREAT LESSON, THANK YOU!!
Sorry, I did sound stupid. When I made the comment about the query being
executed at the server, I was thinking about sending a query from the web
page, which I think would also be executed at the server, which doesn't make
much more sense. The analogy that I was trying to make was the efficiency
of executing a query that is stored on the server, and querying from a
remote location, such as a web page.
Are Views and SPs considered embedded queries? and are SPs compiled to run
faster?
================================================== ============
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45A3C710.9070205@.realsqlguy.com...
> WANNABE wrote:
> Every query is executed "at the server". A view is nothing more than a
> virtual table that can be used to simplify a complex query. A stored
> procedure is a pre-compiled collection of one or more queries.
> Assume that you have three tables containing related information. Each
> time your web page needs data from these tables, they must be joined
> together. Your options for obtaining that data are:
> 1. Embedded query
> The web page directly issues the following query:
> SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
> FROM t1
> INNER JOIN t2
> ON t1.key = t2.key
> INNER JOIN t3
> ON t2.key = t3.key
> 2. View
> The view is defined as:
> CREATE VIEW MyView
> AS
> SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
> FROM t1
> INNER JOIN t2
> ON t1.key = t2.key
> INNER JOIN t3
> ON t2.key = t3.key
> The web page issues this query:
> SELECT col1, col2, col3
> FROM MyView
> 3. Stored Procedure
> The sproc is defined as:
> CREATE PROCEDURE MySproc
> AS
> SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
> FROM t1
> INNER JOIN t2
> ON t1.key = t2.key
> INNER JOIN t3
> ON t2.key = t3.key
> The web page issues this query:
> EXEC MySproc
> All three return the same results, and in all three cases, the "work" is
> done on the server. Now, let's assume that a fourth table is created, and
> this fourth table needs to become part of this join. Option #1 will
> require you to modify the web page to include the new table. Both options
> #2 and #3 allow you to add the table without modifying the query in the
> web page. This is a simple example, however, and more than likely you'll
> need to modify the web page to accept new columns returned from the new
> table.
> The real beauty of using Option #3 is in performance tuning. By using a
> stored proc, you have the flexibility of experimenting with temp tables,
> subqueries, etc. to optimize performance, without the need to modify the
> web page. There are additional security benefits to using stored procs as
> well, because you don't have to grant permissions directly to the tables.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
|||WANNABE wrote:
> THAT IS A GREAT LESSON, THANK YOU!!
> Sorry, I did sound stupid. When I made the comment about the query being
> executed at the server, I was thinking about sending a query from the web
> page, which I think would also be executed at the server, which doesn't make
> much more sense. The analogy that I was trying to make was the efficiency
> of executing a query that is stored on the server, and querying from a
> remote location, such as a web page.
> Are Views and SPs considered embedded queries? and are SPs compiled to run
> faster?
>
An "embedded query" is a SQL statement that is contained within the
source code of an external application, such as a web page, or a VB app.
Understand that views and SP's consist of queries that are hidden from
the calling app, in this case the "embedded query" would be the SELECT
statement that queries the view, or the EXEC statement that runs the SP.
Regarding compilation - EVERY query that is run against a SQL Server is
compiled. With a stored proc, the execution plan that results from
compiling the sproc is saved, so that subsequent calls to the SP, with
similar parameters, can re-use that same execution plan without the
overhead of compiling again. This can be significant for a SP that is
executed hundreds of times per second.
Tracy McKibben
MCDBA
http://www.realsqlguy.com
|||Thanks So Much for all your help. One more Question please;
If a SP contains a statement "ALTER PROCEDURE" Does this cause a
recompilation or What does that statement do?
================================================== =========
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45A4E415.3030807@.realsqlguy.com...
> WANNABE wrote:
> An "embedded query" is a SQL statement that is contained within the source
> code of an external application, such as a web page, or a VB app.
> Understand that views and SP's consist of queries that are hidden from the
> calling app, in this case the "embedded query" would be the SELECT
> statement that queries the view, or the EXEC statement that runs the SP.
> Regarding compilation - EVERY query that is run against a SQL Server is
> compiled. With a stored proc, the execution plan that results from
> compiling the sproc is saved, so that subsequent calls to the SP, with
> similar parameters, can re-use that same execution plan without the
> overhead of compiling again. This can be significant for a SP that is
> executed hundreds of times per second.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com

please provide me some resources

Where I can read up on the best way to provide a data view of SQL 2000 data
for a web page.
My Part in this is to provide a mean for the web guy to read an inventory
list from the database and then he will set that up on the web page... I
feel like such a rookie... I would really appreciate any links or info
that can be provided... ThanksThanks John, The web page will be hosted on a Linux box, I think ?pearl? or
?apache?, these things are said with little familiarity to the Linux and web
area. Does that change things much '
There is much of this that I really don't understand well and I don't expect
anyone to explain it to me but if you can point me in the right direction as
to where to read / learn. A consultant on the outside will access our
network through a DMZ Linux box. So he will not have any domain rights. I
need to provide something (I've created a view) so he can retrieve data to
be viewed from the web site. This should be real-time data. I think this
can be done with the view I created and by creating a SQL login with rights
only to read the view. Is this Right' Am I on the right track or way
off'
================================================="John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:522F2747-B3A8-4C43-B025-1C3DD20C2E97@.microsoft.com...
> Hi
> "WANNABE" wrote:
>> Where I can read up on the best way to provide a data view of SQL 2000
>> data
>> for a web page.
>> My Part in this is to provide a mean for the web guy to read an inventory
>> list from the database and then he will set that up on the web page... I
>> feel like such a rookie... I would really appreciate any links or info
>> that can be provided... Thanks
> This will depend on what you want to write the web page in! For instance
> if
> it is going to be in ASP.NET try starting at
> http://classicasp.aspfaq.com/general/where-can-i-find-out-about-net.html
> or
> for classic ASP try
> http://classicasp.aspfaq.com/general/how-do-i-use-asp-to.html
> John
>|||WANNABE wrote:
> Thanks John, The web page will be hosted on a Linux box, I think ?pearl? or
> ?apache?, these things are said with little familiarity to the Linux and web
> area. Does that change things much '
> There is much of this that I really don't understand well and I don't expect
> anyone to explain it to me but if you can point me in the right direction as
> to where to read / learn. A consultant on the outside will access our
> network through a DMZ Linux box. So he will not have any domain rights. I
> need to provide something (I've created a view) so he can retrieve data to
> be viewed from the web site. This should be real-time data. I think this
> can be done with the view I created and by creating a SQL login with rights
> only to read the view. Is this Right' Am I on the right track or way
> off'
>
You're going to need something to allow the Linux box to talk to SQL
Server. Look up FreeTDS, I've used this in the past to connect PHP
pages to SQL Server. Assuming that's in place, you simply need to
create a SQL login that has the necessary rights, and the web pages will
use that login to execute queries against your database. I would
suggest creating stored procedures instead of embedded queries, it will
be easier for YOU to debug and optimize.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thanks Tracy, You suggested "creating stored procedures instead of embedded
queries" and I'm just guessing, are views considered embedded queries? Now
I am still in training for my MCDBA, but I thought that a view was much like
a stored procedure in that it is executed at the server, but it would
provide the most a display of the most current data in an efficient manner.
I hope I don't sound stupid, but if I do please let me know.
I'm sure there are key differences between SPs and Views, but I'm not sure I
know what they are..
=============================================="Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45A3B567.7000903@.realsqlguy.com...
> WANNABE wrote:
>> Thanks John, The web page will be hosted on a Linux box, I think ?pearl?
>> or ?apache?, these things are said with little familiarity to the Linux
>> and web area. Does that change things much '
>> There is much of this that I really don't understand well and I don't
>> expect anyone to explain it to me but if you can point me in the right
>> direction as to where to read / learn. A consultant on the outside will
>> access our network through a DMZ Linux box. So he will not have any
>> domain rights. I need to provide something (I've created a view) so he
>> can retrieve data to be viewed from the web site. This should be
>> real-time data. I think this can be done with the view I created and by
>> creating a SQL login with rights only to read the view. Is this Right'
>> Am I on the right track or way off'
> You're going to need something to allow the Linux box to talk to SQL
> Server. Look up FreeTDS, I've used this in the past to connect PHP pages
> to SQL Server. Assuming that's in place, you simply need to create a SQL
> login that has the necessary rights, and the web pages will use that login
> to execute queries against your database. I would suggest creating stored
> procedures instead of embedded queries, it will be easier for YOU to debug
> and optimize.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||WANNABE wrote:
> Thanks Tracy, You suggested "creating stored procedures instead of embedded
> queries" and I'm just guessing, are views considered embedded queries? Now
> I am still in training for my MCDBA, but I thought that a view was much like
> a stored procedure in that it is executed at the server, but it would
> provide the most a display of the most current data in an efficient manner.
> I hope I don't sound stupid, but if I do please let me know.
> I'm sure there are key differences between SPs and Views, but I'm not sure I
> know what they are..
Every query is executed "at the server". A view is nothing more than a
virtual table that can be used to simplify a complex query. A stored
procedure is a pre-compiled collection of one or more queries.
Assume that you have three tables containing related information. Each
time your web page needs data from these tables, they must be joined
together. Your options for obtaining that data are:
1. Embedded query
The web page directly issues the following query:
SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
FROM t1
INNER JOIN t2
ON t1.key = t2.key
INNER JOIN t3
ON t2.key = t3.key
2. View
The view is defined as:
CREATE VIEW MyView
AS
SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
FROM t1
INNER JOIN t2
ON t1.key = t2.key
INNER JOIN t3
ON t2.key = t3.key
The web page issues this query:
SELECT col1, col2, col3
FROM MyView
3. Stored Procedure
The sproc is defined as:
CREATE PROCEDURE MySproc
AS
SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
FROM t1
INNER JOIN t2
ON t1.key = t2.key
INNER JOIN t3
ON t2.key = t3.key
The web page issues this query:
EXEC MySproc
All three return the same results, and in all three cases, the "work" is
done on the server. Now, let's assume that a fourth table is created,
and this fourth table needs to become part of this join. Option #1 will
require you to modify the web page to include the new table. Both
options #2 and #3 allow you to add the table without modifying the query
in the web page. This is a simple example, however, and more than
likely you'll need to modify the web page to accept new columns returned
from the new table.
The real beauty of using Option #3 is in performance tuning. By using a
stored proc, you have the flexibility of experimenting with temp tables,
subqueries, etc. to optimize performance, without the need to modify the
web page. There are additional security benefits to using stored procs
as well, because you don't have to grant permissions directly to the tables.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||THAT IS A GREAT LESSON, THANK YOU!!
Sorry, I did sound stupid. When I made the comment about the query being
executed at the server, I was thinking about sending a query from the web
page, which I think would also be executed at the server, which doesn't make
much more sense. The analogy that I was trying to make was the efficiency
of executing a query that is stored on the server, and querying from a
remote location, such as a web page.
Are Views and SPs considered embedded queries? and are SPs compiled to run
faster?
=============================================================="Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45A3C710.9070205@.realsqlguy.com...
> WANNABE wrote:
>> Thanks Tracy, You suggested "creating stored procedures instead of
>> embedded queries" and I'm just guessing, are views considered embedded
>> queries? Now I am still in training for my MCDBA, but I thought that a
>> view was much like a stored procedure in that it is executed at the
>> server, but it would provide the most a display of the most current data
>> in an efficient manner. I hope I don't sound stupid, but if I do please
>> let me know.
>> I'm sure there are key differences between SPs and Views, but I'm not
>> sure I know what they are..
> Every query is executed "at the server". A view is nothing more than a
> virtual table that can be used to simplify a complex query. A stored
> procedure is a pre-compiled collection of one or more queries.
> Assume that you have three tables containing related information. Each
> time your web page needs data from these tables, they must be joined
> together. Your options for obtaining that data are:
> 1. Embedded query
> The web page directly issues the following query:
> SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
> FROM t1
> INNER JOIN t2
> ON t1.key = t2.key
> INNER JOIN t3
> ON t2.key = t3.key
> 2. View
> The view is defined as:
> CREATE VIEW MyView
> AS
> SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
> FROM t1
> INNER JOIN t2
> ON t1.key = t2.key
> INNER JOIN t3
> ON t2.key = t3.key
> The web page issues this query:
> SELECT col1, col2, col3
> FROM MyView
> 3. Stored Procedure
> The sproc is defined as:
> CREATE PROCEDURE MySproc
> AS
> SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
> FROM t1
> INNER JOIN t2
> ON t1.key = t2.key
> INNER JOIN t3
> ON t2.key = t3.key
> The web page issues this query:
> EXEC MySproc
> All three return the same results, and in all three cases, the "work" is
> done on the server. Now, let's assume that a fourth table is created, and
> this fourth table needs to become part of this join. Option #1 will
> require you to modify the web page to include the new table. Both options
> #2 and #3 allow you to add the table without modifying the query in the
> web page. This is a simple example, however, and more than likely you'll
> need to modify the web page to accept new columns returned from the new
> table.
> The real beauty of using Option #3 is in performance tuning. By using a
> stored proc, you have the flexibility of experimenting with temp tables,
> subqueries, etc. to optimize performance, without the need to modify the
> web page. There are additional security benefits to using stored procs as
> well, because you don't have to grant permissions directly to the tables.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||WANNABE wrote:
> THAT IS A GREAT LESSON, THANK YOU!!
> Sorry, I did sound stupid. When I made the comment about the query being
> executed at the server, I was thinking about sending a query from the web
> page, which I think would also be executed at the server, which doesn't make
> much more sense. The analogy that I was trying to make was the efficiency
> of executing a query that is stored on the server, and querying from a
> remote location, such as a web page.
> Are Views and SPs considered embedded queries? and are SPs compiled to run
> faster?
>
An "embedded query" is a SQL statement that is contained within the
source code of an external application, such as a web page, or a VB app.
Understand that views and SP's consist of queries that are hidden from
the calling app, in this case the "embedded query" would be the SELECT
statement that queries the view, or the EXEC statement that runs the SP.
Regarding compilation - EVERY query that is run against a SQL Server is
compiled. With a stored proc, the execution plan that results from
compiling the sproc is saved, so that subsequent calls to the SP, with
similar parameters, can re-use that same execution plan without the
overhead of compiling again. This can be significant for a SP that is
executed hundreds of times per second.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thanks So Much for all your help. One more Question please;
If a SP contains a statement "ALTER PROCEDURE" Does this cause a
recompilation or What does that statement do?
==========================================================="Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45A4E415.3030807@.realsqlguy.com...
> WANNABE wrote:
>> THAT IS A GREAT LESSON, THANK YOU!!
>> Sorry, I did sound stupid. When I made the comment about the query being
>> executed at the server, I was thinking about sending a query from the web
>> page, which I think would also be executed at the server, which doesn't
>> make much more sense. The analogy that I was trying to make was the
>> efficiency of executing a query that is stored on the server, and
>> querying from a remote location, such as a web page.
>> Are Views and SPs considered embedded queries? and are SPs compiled to
>> run faster?
> An "embedded query" is a SQL statement that is contained within the source
> code of an external application, such as a web page, or a VB app.
> Understand that views and SP's consist of queries that are hidden from the
> calling app, in this case the "embedded query" would be the SELECT
> statement that queries the view, or the EXEC statement that runs the SP.
> Regarding compilation - EVERY query that is run against a SQL Server is
> compiled. With a stored proc, the execution plan that results from
> compiling the sproc is saved, so that subsequent calls to the SP, with
> similar parameters, can re-use that same execution plan without the
> overhead of compiling again. This can be significant for a SP that is
> executed hundreds of times per second.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||WANNABE wrote:
> Thanks So Much for all your help. One more Question please;
> If a SP contains a statement "ALTER PROCEDURE" Does this cause a
> recompilation or What does that statement do?
>
That's a common mistake - the SP doesn't "contain" the ALTER statement.
The ALTER statement is an instruction (also known as a DDL statement)
to SQL Server to modify an existing stored procedure, changing its
contents to the code specified after the ALTER statement.
Example:
ALTER PROCEDURE MyProcedure -- this is NOT part of the SP
AS -- nor is this
BEGIN -- SP starts here
SELECT * FROM MyTable -- more SP code
END -- SP ends here
Another way:
DROP PROCEDURE MyProcedure -- NOT part of the SP
GO -- NOT part of the SP
CREATE PROCEDURE MyProcedure -- NOT part of the SP
AS -- NOT part of the SP
BEGIN -- SP starts here
SELECT * FROM MyTable -- more SP code
END -- SP ends here
Make sense?
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||I think it makes sense, but I question my understanding of it. Anything
before a BEGIN or maybe a SELECT if there is no BEGIN, would not actually be
a part of what is compiled in the SP, but rather an instruction to the
compiler. BUT if that is so, when I open a SP to view and I can see the
ALTER instruction, then I think that it would need to be a part of the SP
object that was saved. (Am I correct in calling a SP an Object?) If the
instruction are not compiled, is there something hidden that tells the
system when to execute the instructions and when not to'
===================================================="Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45A50455.7020306@.realsqlguy.com...
> WANNABE wrote:
>> Thanks So Much for all your help. One more Question please;
>> If a SP contains a statement "ALTER PROCEDURE" Does this cause a
>> recompilation or What does that statement do?
> That's a common mistake - the SP doesn't "contain" the ALTER statement.
> The ALTER statement is an instruction (also known as a DDL statement) to
> SQL Server to modify an existing stored procedure, changing its contents
> to the code specified after the ALTER statement.
> Example:
> ALTER PROCEDURE MyProcedure -- this is NOT part of the SP
> AS -- nor is this
> BEGIN -- SP starts here
> SELECT * FROM MyTable -- more SP code
> END -- SP ends here
> Another way:
> DROP PROCEDURE MyProcedure -- NOT part of the SP
> GO -- NOT part of the SP
> CREATE PROCEDURE MyProcedure -- NOT part of the SP
> AS -- NOT part of the SP
> BEGIN -- SP starts here
> SELECT * FROM MyTable -- more SP code
> END -- SP ends here
> Make sense?
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||WANNABE wrote:
> I think it makes sense, but I question my understanding of it. Anything
> before a BEGIN or maybe a SELECT if there is no BEGIN, would not actually be
> a part of what is compiled in the SP, but rather an instruction to the
> compiler. BUT if that is so, when I open a SP to view and I can see the
> ALTER instruction, then I think that it would need to be a part of the SP
> object that was saved. (Am I correct in calling a SP an Object?) If the
> instruction are not compiled, is there something hidden that tells the
> system when to execute the instructions and when not to'
>
The GUI is adding the ALTER statement for you, so that you can make a
change to the sproc and then execute the ALTER script, thus saving your
change.
Tracy McKibben
MCDBA
http://www.realsqlguy.com

please provide me some resources

Where I can read up on the best way to provide a data view of SQL 2000 data
for a web page.
My Part in this is to provide a mean for the web guy to read an inventory
list from the database and then he will set that up on the web page... I
feel like such a rookie... I would really appreciate any links or info
that can be provided... ThanksHi
"WANNABE" wrote:

> Where I can read up on the best way to provide a data view of SQL 2000 dat
a
> for a web page.
> My Part in this is to provide a mean for the web guy to read an inventory
> list from the database and then he will set that up on the web page... I
> feel like such a rookie... I would really appreciate any links or info
> that can be provided... Thanks
>
This will depend on what you want to write the web page in! For instance if
it is going to be in ASP.NET try starting at
http://classicasp.aspfaq.com/genera...-about-net.html or
for classic ASP try
http://classicasp.aspfaq.com/genera...use-asp-to.html
John|||Thanks John, The web page will be hosted on a Linux box, I think ?pearl? or
?apache?, these things are said with little familiarity to the Linux and web
area. Does that change things much '
There is much of this that I really don't understand well and I don't expect
anyone to explain it to me but if you can point me in the right direction as
to where to read / learn. A consultant on the outside will access our
network through a DMZ Linux box. So he will not have any domain rights. I
need to provide something (I've created a view) so he can retrieve data to
be viewed from the web site. This should be real-time data. I think this
can be done with the view I created and by creating a SQL login with rights
only to read the view. Is this Right' Am I on the right track or way
off'
========================================
=========
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:522F2747-B3A8-4C43-B025-1C3DD20C2E97@.microsoft.com...
> Hi
> "WANNABE" wrote:
>
> This will depend on what you want to write the web page in! For instance
> if
> it is going to be in ASP.NET try starting at
> http://classicasp.aspfaq.com/genera...-about-net.html
> or
> for classic ASP try
> http://classicasp.aspfaq.com/genera...use-asp-to.html
> John
>|||Hi
"WANNABE" wrote:

> Thanks John, The web page will be hosted on a Linux box, I think ?pearl? o
r
> ?apache?, these things are said with little familiarity to the Linux and w
eb
> area. Does that change things much '
Although I think there may be something that supports ASP on linux, you may
want to go the JSP/javabeans route. Microsoft do have a JDBC driver for SQL
Server. One thing you will need to consider is how the system will be
maintained and how much that will cost after initial development. I don't
know of any specific website for this, but if you search for them using
Google and/or buy yourself a good book you should be ok.

> There is much of this that I really don't understand well and I don't expe
ct
> anyone to explain it to me but if you can point me in the right direction
as
> to where to read / learn. A consultant on the outside will access our
> network through a DMZ Linux box. So he will not have any domain rights.
I
> need to provide something (I've created a view) so he can retrieve data to
> be viewed from the web site. This should be real-time data. I think this
> can be done with the view I created and by creating a SQL login with right
s
> only to read the view. Is this Right' Am I on the right track or way
> off'
The user associated to the SQL Login, will require SELECT privileges on the
view. If you have set that up then you should be ok. Check what groups this
user is in to make sure that he does not have extra privileges through group
membership.
John|||WANNABE wrote:
> Thanks John, The web page will be hosted on a Linux box, I think ?pearl? o
r
> ?apache?, these things are said with little familiarity to the Linux and w
eb
> area. Does that change things much '
> There is much of this that I really don't understand well and I don't expe
ct
> anyone to explain it to me but if you can point me in the right direction
as
> to where to read / learn. A consultant on the outside will access our
> network through a DMZ Linux box. So he will not have any domain rights.
I
> need to provide something (I've created a view) so he can retrieve data to
> be viewed from the web site. This should be real-time data. I think this
> can be done with the view I created and by creating a SQL login with right
s
> only to read the view. Is this Right' Am I on the right track or way
> off'
>
You're going to need something to allow the Linux box to talk to SQL
Server. Look up FreeTDS, I've used this in the past to connect PHP
pages to SQL Server. Assuming that's in place, you simply need to
create a SQL login that has the necessary rights, and the web pages will
use that login to execute queries against your database. I would
suggest creating stored procedures instead of embedded queries, it will
be easier for YOU to debug and optimize.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thanks Tracy, You suggested "creating stored procedures instead of embedded
queries" and I'm just guessing, are views considered embedded queries? Now
I am still in training for my MCDBA, but I thought that a view was much like
a stored procedure in that it is executed at the server, but it would
provide the most a display of the most current data in an efficient manner.
I hope I don't sound stupid, but if I do please let me know.
I'm sure there are key differences between SPs and Views, but I'm not sure I
know what they are..
========================================
======
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45A3B567.7000903@.realsqlguy.com...
> WANNABE wrote:
> You're going to need something to allow the Linux box to talk to SQL
> Server. Look up FreeTDS, I've used this in the past to connect php pages
> to SQL Server. Assuming that's in place, you simply need to create a SQL
> login that has the necessary rights, and the web pages will use that login
> to execute queries against your database. I would suggest creating stored
> procedures instead of embedded queries, it will be easier for YOU to debug
> and optimize.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||WANNABE wrote:
> Thanks Tracy, You suggested "creating stored procedures instead of embedd
ed
> queries" and I'm just guessing, are views considered embedded queries? No
w
> I am still in training for my MCDBA, but I thought that a view was much li
ke
> a stored procedure in that it is executed at the server, but it would
> provide the most a display of the most current data in an efficient manner
.
> I hope I don't sound stupid, but if I do please let me know.
> I'm sure there are key differences between SPs and Views, but I'm not sure
I
> know what they are..
Every query is executed "at the server". A view is nothing more than a
virtual table that can be used to simplify a complex query. A stored
procedure is a pre-compiled collection of one or more queries.
Assume that you have three tables containing related information. Each
time your web page needs data from these tables, they must be joined
together. Your options for obtaining that data are:
1. Embedded query
The web page directly issues the following query:
SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
FROM t1
INNER JOIN t2
ON t1.key = t2.key
INNER JOIN t3
ON t2.key = t3.key
2. View
The view is defined as:
CREATE VIEW MyView
AS
SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
FROM t1
INNER JOIN t2
ON t1.key = t2.key
INNER JOIN t3
ON t2.key = t3.key
The web page issues this query:
SELECT col1, col2, col3
FROM MyView
3. Stored Procedure
The sproc is defined as:
CREATE PROCEDURE MySproc
AS
SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
FROM t1
INNER JOIN t2
ON t1.key = t2.key
INNER JOIN t3
ON t2.key = t3.key
The web page issues this query:
EXEC MySproc
All three return the same results, and in all three cases, the "work" is
done on the server. Now, let's assume that a fourth table is created,
and this fourth table needs to become part of this join. Option #1 will
require you to modify the web page to include the new table. Both
options #2 and #3 allow you to add the table without modifying the query
in the web page. This is a simple example, however, and more than
likely you'll need to modify the web page to accept new columns returned
from the new table.
The real beauty of using Option #3 is in performance tuning. By using a
stored proc, you have the flexibility of experimenting with temp tables,
subqueries, etc. to optimize performance, without the need to modify the
web page. There are additional security benefits to using stored procs
as well, because you don't have to grant permissions directly to the tables.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||THAT IS A GREAT LESSON, THANK YOU!!
Sorry, I did sound stupid. When I made the comment about the query being
executed at the server, I was thinking about sending a query from the web
page, which I think would also be executed at the server, which doesn't make
much more sense. The analogy that I was trying to make was the efficiency
of executing a query that is stored on the server, and querying from a
remote location, such as a web page.
Are Views and SPs considered embedded queries? and are SPs compiled to run
faster?
========================================
======================
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45A3C710.9070205@.realsqlguy.com...
> WANNABE wrote:
> Every query is executed "at the server". A view is nothing more than a
> virtual table that can be used to simplify a complex query. A stored
> procedure is a pre-compiled collection of one or more queries.
> Assume that you have three tables containing related information. Each
> time your web page needs data from these tables, they must be joined
> together. Your options for obtaining that data are:
> 1. Embedded query
> The web page directly issues the following query:
> SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
> FROM t1
> INNER JOIN t2
> ON t1.key = t2.key
> INNER JOIN t3
> ON t2.key = t3.key
> 2. View
> The view is defined as:
> CREATE VIEW MyView
> AS
> SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
> FROM t1
> INNER JOIN t2
> ON t1.key = t2.key
> INNER JOIN t3
> ON t2.key = t3.key
> The web page issues this query:
> SELECT col1, col2, col3
> FROM MyView
> 3. Stored Procedure
> The sproc is defined as:
> CREATE PROCEDURE MySproc
> AS
> SELECT t1.col2 AS col1, t2.col2 AS col2, t3.col2 AS col3
> FROM t1
> INNER JOIN t2
> ON t1.key = t2.key
> INNER JOIN t3
> ON t2.key = t3.key
> The web page issues this query:
> EXEC MySproc
> All three return the same results, and in all three cases, the "work" is
> done on the server. Now, let's assume that a fourth table is created, and
> this fourth table needs to become part of this join. Option #1 will
> require you to modify the web page to include the new table. Both options
> #2 and #3 allow you to add the table without modifying the query in the
> web page. This is a simple example, however, and more than likely you'll
> need to modify the web page to accept new columns returned from the new
> table.
> The real beauty of using Option #3 is in performance tuning. By using a
> stored proc, you have the flexibility of experimenting with temp tables,
> subqueries, etc. to optimize performance, without the need to modify the
> web page. There are additional security benefits to using stored procs as
> well, because you don't have to grant permissions directly to the tables.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||WANNABE wrote:
> THAT IS A GREAT LESSON, THANK YOU!!
> Sorry, I did sound stupid. When I made the comment about the query being
> executed at the server, I was thinking about sending a query from the web
> page, which I think would also be executed at the server, which doesn't ma
ke
> much more sense. The analogy that I was trying to make was the efficiency
> of executing a query that is stored on the server, and querying from a
> remote location, such as a web page.
> Are Views and SPs considered embedded queries? and are SPs compiled to ru
n
> faster?
>
An "embedded query" is a SQL statement that is contained within the
source code of an external application, such as a web page, or a VB app.
Understand that views and SP's consist of queries that are hidden from
the calling app, in this case the "embedded query" would be the SELECT
statement that queries the view, or the EXEC statement that runs the SP.
Regarding compilation - EVERY query that is run against a SQL Server is
compiled. With a stored proc, the execution plan that results from
compiling the sproc is saved, so that subsequent calls to the SP, with
similar parameters, can re-use that same execution plan without the
overhead of compiling again. This can be significant for a SP that is
executed hundreds of times per second.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thanks So Much for all your help. One more Question please;
If a SP contains a statement "ALTER PROCEDURE" Does this cause a
recompilation or What does that statement do?
========================================
===================
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45A4E415.3030807@.realsqlguy.com...
> WANNABE wrote:
> An "embedded query" is a SQL statement that is contained within the source
> code of an external application, such as a web page, or a VB app.
> Understand that views and SP's consist of queries that are hidden from the
> calling app, in this case the "embedded query" would be the SELECT
> statement that queries the view, or the EXEC statement that runs the SP.
> Regarding compilation - EVERY query that is run against a SQL Server is
> compiled. With a stored proc, the execution plan that results from
> compiling the sproc is saved, so that subsequent calls to the SP, with
> similar parameters, can re-use that same execution plan without the
> overhead of compiling again. This can be significant for a SP that is
> executed hundreds of times per second.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com

Saturday, February 25, 2012

Please Help: Error: Missing semicolon (;) at end of SQL statement.

Hey

I am trying to retieve a value from teh database and add one to it, then update the database with thenew value before redirecting to a page.

I am recieving this error and don't know why, i have the following coed below.


Dim objReaderQ as OleDBDataReader

Dim strSQLRead As String
Dim objCmd As New OleDbCommand

strSQLRead ="Select Quantity from tblCart Where (Productid=" & intProdidHold & ") AND (Cartid='" & strCartid & "')"

objCmd = new OleDbCommand(strSQLRead, objConn)
objReaderQ = objCmd.ExecuteReader()

if objReaderQ.Read()
'update quantity by 1

Dim i as integer
i = objReaderQ("quantity")
i = i + 1

objReaderQ.Close()

Dim strSQLQuantity as String = "INSERT INTO tblCart (Quantity) VALUES (@.quantity) WHERE (productid=" & intProdidHold & ") AND (Cartid='" & strCartid & "');"

Dim objCmdQuantity As New OleDbCommand(strSQLQuantity, objConn)

objCmdQuantity.Connection = objConn

objCmdQuantity.Parameters.Add("@.quantity", OleDbType.VarChar, 255)
objCmdQuantity.Parameters("@.quantity").Value = i

objCmdQuantity.ExecuteNonQuery() ' <-- Error Is Occuring On This Line

Response.Redirect("ViewBasket.aspx")

end if

I really can't see what is wrong as i have placed the semi colon it wanted at the end of the string.

Thanks you for your time

ChrisHey,

I have solved this problem, wrong sql statement, should be update! lol :(

But i do have the problem that once go to the viewbasket.aspx page it shows the product with the quantity 1, as it pulls the quantity from the db and its default value is 1 (which is correct).

But now if that same product is clicked 'Add To basket' for a second time, it executes the above code and goes to the viewbasket.aspx page, but the quantity stays as 1 ! (should be 2)

And now if that same product is clicked 'Add To basket' for a third time, it executes the above code again and goes to the viewbasket.aspx page, but this time the quantity is 2 ! (should be 3)

From this point on the code worked fine and increments the number properly, 4,5,6 etc..

Any idea why the first two clicks dont work ?

Thank you for your help

Chris