Showing posts with label learn. Show all posts
Showing posts with label learn. Show all posts

Friday, March 30, 2012

Help on using LIKE in sproc

hi all,

I'm trying to learn using sproc in ASP.NET, but ran into problems I couldn't solve. Here're the details

My Table (JournalArticle)
ArticleID - int (PK)
ArticleTitle - varchar
ArticleContent - text

I could run a normal sql string against the table itself in ASP.NET and got the results I expect.
but when using a sproc, i couldn't get anything
The sproc


CREATE PROCEDURE dbo.sp_ArticleSearch(@.srch text)
AS SELECT ArticleID, ArticleTitle, ArticleContent
FROM dbo.JournalArticle
WHERE (ArticleAbstract LIKE @.srch)
GO

After reading some of the threads here, I experimented by changing ArticleContent and @.srch to type varchar, still no luck, it's not returning anything.
I think the problem is when i set the value of @.srch (being new at this, I could be seriously wrong though), like this:

prmSearch.ParameterName = "@.srch"
prmSearch.SqlDbType = SqlDbType.Text
prmSearch.Value = Request.Form("txtSearch")

My original string looks like this

strSQL = "SELECT * FROM JournalArticle WHERE (ArticleContent LIKE '%" & Request.Form("txtSearch") & "%')"

What am I doing wrong?? Thanks in advance for any help.Hey, I'm new to sprocs but I have never seen the first line like that. i usually write them and seen them liek this;

CREATE PROCEDURE dbo.sp_ArticleSearch
@.srch text
as...

If that isn't the problem then could it be the LIKE part? Should it not have '%' too? or some other char for t-sql?

I may not know the correct answer, but try it and let me know, cuz i too am in the learning process and will use statements like that in the furture.|||You absolutely need to add the % wildcards to get this work for you the way it used to work.

You either need to add the '%' to the @.srch parameter:


CREATE PROCEDURE dbo.sp_ArticleSearch(@.srch text)
AS
SET NOCOUNT ON
SELECT @.srch = '%' + @.srch + '%'
SELECT ArticleID, ArticleTitle, ArticleContent
FROM dbo.JournalArticle
WHERE (ArticleAbstract LIKE @.srch)
GO

Or you need to append the wildcards directly in the SQL statement

CREATE PROCEDURE dbo.sp_ArticleSearch(@.srch text)
AS
SET NOCOUNT ON
SELECT ArticleID, ArticleTitle, ArticleContent
FROM dbo.JournalArticle
WHERE (ArticleAbstract LIKE '%' + @.srch + '%')
GO

It seems the general consensus is that the first option is the best way to go. Note that I added SET NOCOUNT ON to your sproc. This is especially necessary for the first sproc since without it SQL will send something like '1 item selected' as the first resultset back to your ASP.NET page.

Terri|||Thanks guys, will give this a try later.|||Terri, still no luck,

both of the sample procedures gave error:

Error 403 Invalid Operator For Data Type. Operator Equals Add. Type equals Text.

I've absolutely no idea what this means.|||OK, I got this to work if the parameter type is set to 'varchar' instead of 'text' in the stored procedure itself so it'll look like this:


CREATE PROCEDURE dbo.sp_ArticleSearch(@.srch varchar(8000))
AS
SET NOCOUNT ON
SELECT *
FROM dbo.JournalArticle
WHERE (ArticleAbstract LIKE '%' + @.srch + '%')
GO

Thank you very much guys.|||I found that error to be is data-type mismatch. Is the field 'ArticleAbstract' data-type text? as u declared @.srch to be?|||heh, u beat me to itsql

Help on Sybase Power Designeer

Hi,
I want to learn Sybase Power Designer...but i dint find right meterial till
now .
Can anybody give me the links for the tutorials or articles..
Thanx for the help guys
KumarTry the sybase website - and then the appropriate sybase newsgroups.sql

Wednesday, March 28, 2012

Help on setting up Reporting Service...

I am new to Reporting Services. I set up the infrastruicture with two
computers to learn the Reporting Service, a stand alone server (No DNS and
AD and not a domain server) and a workstation, and both computers are in the
same workgroup. On the server computer I have a SQL 2000 SP4, mixed mode,
running on a Windows 2003 Server SP1. The second computer is installed with
the Reporting Service SP2 and is running on Windows XP Professional SP2 with
IIS enabled, also I have Visual Studio 2003 installed on this box to create
test reports. I can create and deploy reports using the Visual Studio 2003
and also view the report by typing the something like http://<IIS Server
Name>/ReportServer on the address bar in the Internet Explorer on the
workstation within the LAN. It opens the Report Manager UI and I can see all
the reports I deployed using the VS 2003. However if I try to access the
Report Manager from a remote location which I asked my friend try it from
his home computer by typing http://<My IIS public IP address>/ReportServer
and it did not work. I know that it is something to do with the security
setting with the IIS and the SQL 2000. How can I change the setting to allow
remote computer to access the reports directly or using the Report Manager
UI? Also how can I implment security to stop people access the reports or
Report Manager UI? Should I implement the security at the IIS server or to
the SQL 2000 or on individual database? Or should I implement the security
on both IIS and SQL 2000 and database? Thanks.I had a similar issue with the Firewall on XP SP2. You can add exclusions
to the firewall using the firewall administrator.
--
| From: "Paul" <paul_mak@.hotmail.com>
| Subject: Help on setting up Reporting Service...
| Date: Thu, 25 Aug 2005 10:38:13 -0700
| Lines: 23
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <#UqJ3vZqFHA.272@.TK2MSFTNGP15.phx.gbl>
| Newsgroups: microsoft.public.sqlserver.reportingsvcs
| NNTP-Posting-Host: 64.114.25.49
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.reportingsvcs:51138
| X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
|
| I am new to Reporting Services. I set up the infrastruicture with two
| computers to learn the Reporting Service, a stand alone server (No DNS
and
| AD and not a domain server) and a workstation, and both computers are in
the
| same workgroup. On the server computer I have a SQL 2000 SP4, mixed mode,
| running on a Windows 2003 Server SP1. The second computer is installed
with
| the Reporting Service SP2 and is running on Windows XP Professional SP2
with
| IIS enabled, also I have Visual Studio 2003 installed on this box to
create
| test reports. I can create and deploy reports using the Visual Studio
2003
| and also view the report by typing the something like http://<IIS Server
| Name>/ReportServer on the address bar in the Internet Explorer on the
| workstation within the LAN. It opens the Report Manager UI and I can see
all
| the reports I deployed using the VS 2003. However if I try to access the
| Report Manager from a remote location which I asked my friend try it from
| his home computer by typing http://<My IIS public IP
address>/ReportServer
| and it did not work. I know that it is something to do with the security
| setting with the IIS and the SQL 2000. How can I change the setting to
allow
| remote computer to access the reports directly or using the Report
Manager
| UI? Also how can I implment security to stop people access the reports or
| Report Manager UI? Should I implement the security at the IIS server or
to
| the SQL 2000 or on individual database? Or should I implement the
security
| on both IIS and SQL 2000 and database? Thanks.
|
|
|

Monday, February 27, 2012

help me!beginner create database password

I've learn DotNetNuke.I don't know how to create passID and userID for database sqlserver2005 express.someone help me.Thanks!thanks!You can do that by using the appropiate TSQL command, like sp_AddLogin and so forth, but as a beginner I would suggest you to use the SQL Server Management Express which has a graphical interface to administer the server instance. You will have to create a user and map the user to the appropiate database. There you will have to either grant him a role or dedicated permissions on the securables (objects) within the database.

http://msdn.microsoft.com/vstudio/express/sql/download/

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de|||

can you help me how step by step I have to do:

right click database(example I've created database name"dotnetnuke")?

then choose properties->choose permissions?

Or can you tell me TSQL command...?

Thank you very much!

|||

I've created new users name"dnnusers" and set some permissions but I've recieved some instructions:

"Grant failed for Database 'DotNetNuke'. (Microsoft.SqlServer.Smo)"why?


Sunday, February 19, 2012

Help me friends...

Dear All,
I am a software programmer at initio i wish to improve my back-end side in SQL Server 2000.

I wish to learn it asap and i wish to become Database Administrator.

So, I need your help as i am a beginner and if you have any links or turorial to learn it please provide me.

Thanks.
Truly yours,
MaxHi,
I suggest you go to microsoft.com and go to the links for SQL Server. You can also try msdn.microsoft.com, as they have lots of material about SQL Server their too. As you say you're a programmer, try to keep in mind that designing, implementing and maintaining a relational database requires a different way of looking at things than it does in most programming environments. Do some research on relational database management systems (RDBMS), as that's the core idea that SQL Server is built around. Once you start thinking in terms of data structure, rather than in procedural processing, you'll find the topic a lot easier to digest. Good luck. BRN..|||I totally agree with Brian27. You really should be checking outthe source of the database, and that would be Microsoft.com. Onething to understand and acknowledge is that you will not be proficientwithout experience. I've seen people read these tutorials,how-to's, and life stories without experiencing the design from startto end on a number of occasions. They always make a trainwreck ofthings, and it's a very frustrating experience. Your best bet isto read the articles written (aspalliance has a bunch of good onestoo), and try to get yourself involved in the database design processat your current employer if they have a DBA. You can also look upinformation on the MCDBA, as that exam gets pretty extensive in thedatabase management.
Good Luck, and hope you find what you're looking for.
|||

Dear Sir,

Thanking you for your such a valuable suggestion.
I am also seeking job for team environment where i can have such options.. as my current employer dont have much expansion capability. I am good at VB,ASP and at Entry Level for .Net.

So, can you help me in this regard ?

With regards,
< Max_007 >