Showing posts with label asp. Show all posts
Showing posts with label asp. 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 Stored Procedures

I am learning to make a ASP web site and feel that if i can do it the harder way using some stored procedures instead of using multiple datasources on each page requiring that it might be better.

So i am wondering what are these used for:

DECLARE vs just entering "@.param1 varchar(30)"When i use "DECLARE @.rc int" i get the error "Incorrect syntax near DECLARE"
How to return values to ASP page in Visual Studio 2005
How to use @.@.rowcount - doesn't seem to work for me?i tried using
DECLARE @.rc int
SET @.rc = @.@.rowcountWhen to use GO, BEGIN etcIf i want to use the variable only in the procedure, and not needed to be inputed, do i need to put it in the CREATE PROCEDURE (section)?Should i use my own stored procedures or VS2005 created ones using datasources? not really procedures but SQL, in SQL can i do like IF ELSE? if i use my own i cant use the Optimistic Concurrency right? and whats that?

You need to read some basic tutorials on stored procedures.

http://www.awprofessional.com/articles/article.asp?p=25288&rl=1

http://www.functionx.com/sqlserver/Lesson16.htm

http://www.quackit.com/sql_server/tutorial/sql_server_stored_procedures.cfm

Also, Tatworth gave you some good links when you asked about this a few days ago.http://forums.asp.net/p/1118089/1757710.aspx#1757710

Monday, March 26, 2012

Help on N - Tier architecture ?

Hi
1. I am in process of designing N-Tier Application using ASP.NET. Can
anyone guide me the right material or microsoft guidelines document
which I can used in designing the N-Tier application.
2. I would also like to know whether to use Web Services or .Net
Remoting in designing N-Tier application
3. General 3 Tier architecture has 3 Tier : Presentation Layer ,
Business Layer and Database Layer
How this 3 layers are seperated out in N-Tier architecture.
Help would be very much appreciated.
Thanks
Silent Ocean
This is a little off-topic for this newsgroup.
However, http://msdn.microsoft.com/practices/ is a pretty good starting
poitn for architectural/design guidance for MS technologies.
Cheers,
Graeme
Graeme Malcolm
Principal Technologist
Content Master
- a member of CM Group Ltd.
www.contentmaster.com
"Silent Ocean" <silentocean555@.yahoo.com> wrote in message
news:%23e4PMIhnFHA.2852@.TK2MSFTNGP15.phx.gbl...
Hi
1. I am in process of designing N-Tier Application using ASP.NET. Can
anyone guide me the right material or microsoft guidelines document
which I can used in designing the N-Tier application.
2. I would also like to know whether to use Web Services or .Net
Remoting in designing N-Tier application
3. General 3 Tier architecture has 3 Tier : Presentation Layer ,
Business Layer and Database Layer
How this 3 layers are seperated out in N-Tier architecture.
Help would be very much appreciated.
Thanks
Silent Ocean
sql

Help on N - Tier architecture ?

Hi
1. I am in process of designing N-Tier Application using ASP.NET. Can
anyone guide me the right material or microsoft guidelines document
which I can used in designing the N-Tier application.
2. I would also like to know whether to use Web Services or .Net
Remoting in designing N-Tier application
3. General 3 Tier architecture has 3 Tier : Presentation Layer ,
Business Layer and Database Layer
How this 3 layers are seperated out in N-Tier architecture.
Help would be very much appreciated.
Thanks
Silent OceanThis is a little off-topic for this newsgroup.
However, http://msdn.microsoft.com/practices/ is a pretty good starting
poitn for architectural/design guidance for MS technologies.
Cheers,
Graeme
Graeme Malcolm
Principal Technologist
Content Master
- a member of CM Group Ltd.
www.contentmaster.com
"Silent Ocean" <silentocean555@.yahoo.com> wrote in message
news:%23e4PMIhnFHA.2852@.TK2MSFTNGP15.phx.gbl...
Hi
1. I am in process of designing N-Tier Application using ASP.NET. Can
anyone guide me the right material or microsoft guidelines document
which I can used in designing the N-Tier application.
2. I would also like to know whether to use Web Services or .Net
Remoting in designing N-Tier application
3. General 3 Tier architecture has 3 Tier : Presentation Layer ,
Business Layer and Database Layer
How this 3 layers are seperated out in N-Tier architecture.
Help would be very much appreciated.
Thanks
Silent Ocean

Friday, March 23, 2012

Help on elapse time to return data ??

Dear all,
I have build an ASP.net application which calls different store procedure.
When my customer request data from store procedure, I would like to display
on the page, the time it takes to return data.
How to do that ?
regards
sergeSomething like that
create proc myproc1
as
--here is your body's code
--usage
declare @.dt datetime
set @.dt=getdate()
exec myproc1
select datediff(s,@.dt,getdate())
drop proc myproc1
"serge calderara" <sergecalderara@.discussions.microsoft.com> wrote in
message news:0A3D7622-0901-420D-A5F1-CCF7127BE43C@.microsoft.com...
> Dear all,
> I have build an ASP.net application which calls different store procedure.
> When my customer request data from store procedure, I would like to
> display
> on the page, the time it takes to return data.
> How to do that ?
> regards
> serge|||To add to Uri's response, you can also calculate the elapsed time in your
application. C# example:
DateTime startTime = DateTime.Now;
//execute query
TimeSpan duration = DateTime.Now.Subtract(startTime);
Response.Write(duration.ToString();
Hope this helps.
Dan Guzman
SQL Server MVP
"serge calderara" <sergecalderara@.discussions.microsoft.com> wrote in
message news:0A3D7622-0901-420D-A5F1-CCF7127BE43C@.microsoft.com...
> Dear all,
> I have build an ASP.net application which calls different store procedure.
> When my customer request data from store procedure, I would like to
> display
> on the page, the time it takes to return data.
> How to do that ?
> regards
> serge|||Thnaks dan, I will do that
regards
serge
"Dan Guzman" wrote:

> To add to Uri's response, you can also calculate the elapsed time in your
> application. C# example:
> DateTime startTime = DateTime.Now;
> //execute query
> TimeSpan duration = DateTime.Now.Subtract(startTime);
> Response.Write(duration.ToString();
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "serge calderara" <sergecalderara@.discussions.microsoft.com> wrote in
> message news:0A3D7622-0901-420D-A5F1-CCF7127BE43C@.microsoft.com...
>
>

Wednesday, March 21, 2012

help -Object reference not set to an instance of an object.

i m new for asp.net

when i run app. i got this error,

-----
Object reference not set to an instance of an object.

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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 49:
Line 50: adpt.Fill(ds, "SMS_student_class_master")
Line 51: txt.Text = ds.Tables.Item("roll_no").ToString
Line 52: con.Close()
Line 53: End Sub

Source File: c:\inetpub\wwwroot\aspnet\sms\assignment_d.aspx.vb Line: 51
------

my source code given below,

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsNothing(Request.QueryString("id")) Then
sid = Request.QueryString("id")
End If
Dim con As New SqlConnection
Dim constr As String
Dim cmd As New SqlCommand
Dim ds As New DataSet
Dim adpt As New SqlDataAdapter

constr = "data source=Baroda;user id=sa;password=;" & _
"initial catalog=SMS;persist security info=False;workstation id=Baroda;Packet size=4096"
con.ConnectionString = constr
con.Open()

cmd.CommandText = "SELECT * FROM SMS_student_class_master WHERE " & _
"stud_id='" + sid + "'"
cmd.Connection = con
adpt.SelectCommand = cmd

adpt.Fill(ds, "SMS_student_class_master")
txt.Text = ds.Tables.Item("roll_no").ToString
con.Close()
End Sub
---

what should i do?
anyone have any idea?
plz give solution.
its urgent.

thanks in advance.cmd.Connection = con
adpt = new SqlDataAdapter(cmd)
adpt.Fill(...)

Monday, March 19, 2012

Help needed with Primary Key and Identity

I have some code in my ASP.NET page which uses a SQL 2000 Database that was created before creating the ASP Page. The problem I'm having is using an insert statement such as the following example from the DATAGRID example on the Matrix Product. I want the option to create new rows but my Primary Key doesn't allow Nulls and when I hard code a number in the first field of my table for my ID...it's not automatically generated. I've looked through this forum but I'm having some problems understanding what others have done with Identity or GUID's...etc...:

Sub AddNew_Click(Sender As Object, E As EventArgs)

' add a new row to the end of the data, and set editing mode 'on'

CheckIsEditing("")

If Not isEditing = True Then

' set the flag so we know to do an insert at Update time
AddingNew = True

' add new row to the end of the dataset after binding

' first get the data
Dim myConnection As New SqlConnection(ConnectionString)
Dim myCommand As New SqlDataAdapter(SelectCommand, myConnection)

Dim ds As New DataSet()
myCommand.Fill(ds)

' add a new blank row to the end of the data
Dim rowValues As Object() = {"", "", ""}
ds.Tables(0).Rows.Add(rowValues)

' figure out the EditItemIndex, last record on last page
Dim recordCount As Integer = ds.Tables(0).Rows.Count

If recordCount > 1 Then

recordCount -= 1
DataGrid1.CurrentPageIndex = recordCount \ DataGrid1.PageSize
DataGrid1.EditItemIndex = recordCount Mod DataGrid1.PageSize

End If

' databind
DataGrid1.DataSource = ds
DataGrid1.DataBind()

End If

End Subds.Tables(0).Columns("YourPrimaryKey").IncrementSeed = 1
ds.Tables(0).Columns("YourPrimaryKey")... other properties you need to set to make it an identity.|||Right now I'm using an "ID" field as the primary key and it is setup in SQL as an identity but when I try to add a row...it says..

System.Data.SqlClient.SqlException: Cannot insert explicit value for identity column in table 'CustomerInfo' when IDENTITY_INSERT is set to OFF. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at ASP.OrderEdit_aspx.DataGrid_Update(Object Sender, DataGridCommandEventArgs E

Would I need to remove the identity setting in SQL and create the identity through my code or is there a way to specify that my "ID" field is a primary key and it needs to be incremented by 1 whenever a new row is added?

Thanks for the help!!

Friday, March 9, 2012

Help needed for SSRS 2005(Regarding html code)

Hi Experts,
I am working on SSRS 2005, and I am facing a problem in this.
We are using an ASP.net application in which user fills a form. Some
fields contain text fields and we are entering all the fields in our
database through application.
But when we are entering values from application then our database
contains some html code in some fields with data.
Now I want to show those fields in my report, Values coming from
database in my report but they are in html format. So it is not
readable in report.
Now you people tell me how to solve this issue in my reports. I want
that data in my report as user entered in the application form.
Any help will be appreciated.
Regards
DineshDinesh,
The only thing I can think of is writing a function which strips out the
HTML tags and then call that function for each field in your report. You
could make this function a Report Code Block or even better, put it in an
assembly referenced by the Report.
--
Andy Potter
blog : http://sqlreportingservices.spaces.live.com
info@.(NOSPAM)lakeclaireenterprises.com
"Dinesh" <dinesht15@.gmail.com> wrote in message
news:1176467678.190725.177080@.y80g2000hsf.googlegroups.com...
> Hi Experts,
> I am working on SSRS 2005, and I am facing a problem in this.
> We are using an ASP.net application in which user fills a form. Some
> fields contain text fields and we are entering all the fields in our
> database through application.
> But when we are entering values from application then our database
> contains some html code in some fields with data.
> Now I want to show those fields in my report, Values coming from
> database in my report but they are in html format. So it is not
> readable in report.
> Now you people tell me how to solve this issue in my reports. I want
> that data in my report as user entered in the application form.
> Any help will be appreciated.
> Regards
> Dinesh
>

Help needed for accessing Report server from an ASP.Net application

Hi experts,
I have an ASP.Net application by which we are calling our remote
report server.
Till then it is fine but when i am clicking on any report then a pop
up window comes and it is
asking for username and password to logon on report server.
I want to remove this popup login screen,
I have tried to pass the credentials both default and network but it
is still asking for
username and password.
I think one method which is in Web service 2005 is BeginLogon() or
Logon() will work if i will pass them
from my application
But i dont know how to implement them in my application.
Can any body send me some code for implementing them
or suggest anything which can help me to solve this issue.
Regards
DineshOn Mar 27, 2:46 am, "Dinesh" <dinesh...@.gmail.com> wrote:
> Hi experts,
> I have an ASP.Net application by which we are calling our remote
> report server.
> Till then it is fine but when i am clicking on any report then a pop
> up window comes and it is
> asking for username and password to logon on report server.
> I want to remove this popup login screen,
> I have tried to pass the credentials both default and network but it
> is still asking for
> username and password.
> I think one method which is in Web service 2005 is BeginLogon() or
> Logon() will work if i will pass them
> from my application
> But i dont know how to implement them in my application.
> Can any body send me some code for implementing them
> or suggest anything which can help me to solve this issue.
> Regards
> Dinesh
Just a couple of thoughts. I usually experience the authentication
window whenever I'm using a browser other than IE as my default
(namely, Firefox/Mozilla). Is this the case? Also, have you tried
setting the 'Windows integrated security' or 'Credentials stored
securely in the report server' and 'Use as Windows credentials when
connecting to the datasource' options in the Properties tab of the
particular report(s) in Report Manager?
Regards,
Enrique Martinez
Sr. Software Consultant|||Is the logon screen for your report server or your web server hosting
your application?|||On Apr 6, 11:38 pm, "Lynn" <linqian...@.gmail.com> wrote:
> Is the logon screen for your report server or your web server hosting
> your application?
Log on screen for my report server.
We are giving report viewer url in application. when it is calling the
report server then it is showing the log in scree and i want to remove
that so that after clicking on any report name it will directly
redirect to report server withous asking any user name and password.
Regards
Dinesh

Wednesday, March 7, 2012

Help needed

Hello,
When I try to run my asp file it gives me this error. :mad:

Technical Information (for support personnel)

Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E07)
Syntax error converting datetime from character string.
/conOpen_inc.asp, line 10

Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)

Page:
GET /Default.asp

Anyone can tell me whats happening ? thank youwhat is the format of your Dates ?|||Am sorry I didn't get you but if you mean this one:-

Long date format is dddd, MMMM dd, yyyy
and short date format is M/d/yyyy

is this what you mean ?|||I think what Karolyn ment is what is the dateformat of the character string which holds the date/s versus the dateformat the program converts to (when specified).|||Am sorry I'm not expert in this I was trying to install KEWL (Konwledge Environment Web-Based Learning). Here is the link

http://kewlforge.uwc.ac.za/downloads/kewl.zip
I did follow the instructions step by step.

Any help will be appericiated|||i dont know what is the link doing, but as what Karolyn and Kaiowa mention, check you datetime format. Normally, will get this error is because of dateformat of the character string which holds the date is not recognized by sql server. The date format that you give is from you regional setting is it? you can try to change it to sql server date time format and try again.

Monday, February 27, 2012

Help Me! How can I use SQL Server Subreports in Visual Web Developer Express Edition

Hi,

I use Visual Web Developer 2005 Express Edition. Anybody help me how can i use reports and subreports with parameters in it. I am new to ASP.NET. Please give me a sample. Thanks in advance.

Take a look at this article "Adding a Subreport with Parameters", it might be able to help you.

http://msdn2.microsoft.com/en-US/library/aa337490.aspx

Hope this helps.

Jarret

Help me write a Search function please

Hi all,

I'm very new to ASP.NET stuffs, I'm trying to write a Search function for my website... I have two text boxes, one if called "SongTitle" and the other is "Artist"... Now I need to populate the GridView to display the result, based on the input of the textbox... So if only the "SongTitle" have input, it will search for the Song Titles on the database... if the Artist is searched, then it will return the artist... If both text boxes have value in them, then it need to check for both fields in the database and return the correct item...

For the "Artist", I have 2 columns in the Database (originalArtist and performer), so for the Artist select statement, it need to check both columns on the table, if any of them match then it will return the item.

Any help would be greatly appreciated,

Thank you all,

Kenny.

Try something like this:

SELECTFROM YourTableWHERE (@.SongTitleISNULL OR SongTitle = @.SongTitle)AND (@.ArtistISNULL OR (originalArtist = @.ArtistOR Performer = @.Artist ))
|||

ndinakar,

Thank you very much, here is what I put for my SqlDataSource, but it doesn't appear to work... Nothing returned when I try to search, using just the artist, the song, or both for the input:

<asp:SqlDataSource ID="DSResults" runat="server" ConnectionString="<%$ ConnectionStrings:notesnhacConnectionString1 %>"
SelectCommand="SELECT DISTINCT [MUSIC_TITLE], [MUSIC_ORIGINAL_SINGER], [MUSIC_PERFORMER] FROM [t_music] WHERE (@.MUSIC_TITLE IS NULL OR [MUSIC_TITLE2] LIKE '%' + @.MUSIC_TITLE + '%') AND (@.MUSIC_ARTIST IS NULL OR [MUSIC_ORIGINAL_SINGER] LIKE '%' + @.MUSIC_ARTIST + '%' OR [MUSIC_PERFORMER] LIKE '%' + @.MUSIC_ARTIST + '%')">
<SelectParameters>
<asp:QueryStringParameter Name="MUSIC_TITLE" QueryStringField="title" Type="String" />
<asp:QueryStringParameter Name="MUSIC_ARTIST" QueryStringField="artist" Type="String" />
</SelectParameters>
</asp:SqlDataSource>

|||

If you run thre query in your query analyzer with some values for the parameters does it work as expected? If not, post some sample data from your table and the query you used so we can better understand why its not working.

|||

Here is what I put on the Query window of SQL Manager Studio Express:

DECLARE @.MUSIC_TITLE NVARCHAR(100)
DECLARE @.MUSIC_ARTIST NVARCHAR(100)

SELECT DISTINCT [MUSIC_TITLE], [MUSIC_ORIGINAL_SINGER], [MUSIC_PERFORMER]
FROM [t_music]
WHERE (@.MUSIC_TITLE IS NULL OR [MUSIC_TITLE] LIKE '%' + @.MUSIC_TITLE + '%') AND (@.MUSIC_ARTIST IS NULL OR [MUSIC_ORIGINAL_SINGER] LIKE '%' + @.MUSIC_ARTIST + '%' OR [MUSIC_PERFORMER] LIKE '%' + @.MUSIC_ARTIST + '%')

SET @.MUSIC_TITLE = 'Everytime'
SET @.MUSIC_ARTIST = 'Cascada'

I've tried to use just @.MUSIC_TITLE, or just @.MUSIC_ARTIST, and both... each time it return ALL the records in the table... But if I execute the same select statement in VS 2005, it returns nothing... In the table, there is a song called "Everytime We Touch" performed by Cascada.

|||

Are you setting the values after running the SELECT? post some sample data from your table so I can test it on my machine..

|||

sorry. you need to use OR instead of AND in your WHERE clause.

|||

As you can see I have the SET @.MUSIC_TITLE = 'Everytime' in the previous post... Here are some sample data:

MUSIC_TITLE MUSIC_ORIGINAL_SINGER MUSIC_PERFORMER

Everytime We Touch Cascada Cascada

Dancing Queen ABBA Purity

Heaven Bryan Adam

Hotel California Eagles Eagles

Thank you very much for your help,

Kenny.

|||

Changed the "AND" to "OR" have helped, but I have some problem:

1. If I don't enter anything for the "Artist" or in the "Title" box (meaning only of the box have input), no records returned even if I type part of the name of the song/artist, or even the full name of the song/artist.

2. For example if I have two songs that have some similiar words, i.e. "Hotel", in the Title box I typed "Hotel" and in the Artist box, I typed "Eagles", which should return 1 record only that contain both Hotel & Eagles in the record... But instead it returns all the songs with "Hotel" in it.

Thanks again,

Kenny.

|||

I think we had it right the first time itself. AND should work.

|||

Dinakar,

You are right, the "AND" should work... The problem is that it only works if both the Title and Artist text box have values in them... Leaving one or the other blank does not return any results even if they should be... Any help?

Thank you,

Kenny.

|||

HEre's a sample I set up. I was able to get both records when I used "hotel" for music_title and left the second field blank.

Declare @.ttable (col1int identity, MUSIC_TITLEvarchar(50), MUSIC_ORIGINAL_SINGERvarchar(50), MUSIC_PERFORMERvarchar(50))insert into @.tvalues ('Everytime We Touch','Cascada','Cascada')insert into @.tvalues ('Dancing Queen','ABBA','Purity')insert into @.tvalues ('hotel','Bryan Adam',null)insert into @.tvalues ('Hotel California','Eagles','Cascada')DECLARE @.MUSIC_TITLENVARCHAR(100)DECLARE @.MUSIC_ARTISTNVARCHAR(100)SET @.MUSIC_TITLE ='hotel'SET @.MUSIC_ARTIST =nullSELECT DISTINCT [MUSIC_TITLE], [MUSIC_ORIGINAL_SINGER], [MUSIC_PERFORMER]FROM @.t--where ([MUSIC_ORIGINAL_SINGER] LIKE '%' + @.MUSIC_ARTIST + '%' OR [MUSIC_PERFORMER] LIKE '%' + @.MUSIC_ARTIST + '%')WHERE (@.MUSIC_TITLEISNULL OR [MUSIC_TITLE]LIKE'%' + @.MUSIC_TITLE +'%')AND (@.MUSIC_ARTISTISNULL OR ([MUSIC_ORIGINAL_SINGER]LIKE'%' + @.MUSIC_ARTIST +'%'OR [MUSIC_PERFORMER]LIKE'%' + @.MUSIC_ARTIST +'%'))
|||

I tried the code above in SQL Manager Studio and they seems to work as expected... but somehow it doesn't work with my SqlDataSource! I don't know what else I have to do...

Thank you very, very much for your help Dinakar.

Kenny.

|||

I think that it doesn't work with SqlDataSource because the empty string (when nothing was entered in either one of the textbox) doesn't mean null in ADO.NET... Can anyone help me convert this to a code-behind, or help me convert that empty string to null? I would love to put this in code-behind file but like I said in my first post, I'm very new to ASP.NET.

Thanks,

Kenny.

|||

Unfortunately I dont do any .NET code so I cant help you there. Perhaps you can create a new post and someone might help you there. Posts with 0 replies have a better chance of being "looked at" than the ones with 12 replies.

Help me with this problem, please!

I have a question..
I had to put times in this process but I don't have idea
how to do this.
The enterprise use SQL Server 2000 and pages ASP, and
their server is in Corea.
Could be by DTS in SQL server, but I'm not sure it it
possible with DTS..
Section, send automatically post card
This process send post card in birthdays of employees.
This will run dialy for to send automatically post card to
employes who is him birthday that day..
Somebody knows how to do that and could be recommend
another way if it's not possible with DTS..
Please, send me the answer to my mail
bmartinez@.cosapisoft.com.pe
Thanks anyway
Grettings
BrunoDepending on the setup you have to accomplish this task,
you can use a DTS package scheduled every day to execute
the send postcard process.
Please let me know if you have any questions.
Edgardo Valdez
MCSD, MCDBA, MCSE, MCP+I
http://www.edgardovaldez.us/
>--Original Message--
>I have a question..
>I had to put times in this process but I don't have idea
>how to do this.
>The enterprise use SQL Server 2000 and pages ASP, and
>their server is in Corea.
>Could be by DTS in SQL server, but I'm not sure it it
>possible with DTS..
>Section, send automatically post card
>This process send post card in birthdays of employees.
>This will run dialy for to send automatically post card
to
>employes who is him birthday that day..
>Somebody knows how to do that and could be recommend
>another way if it's not possible with DTS..
>Please, send me the answer to my mail
>bmartinez@.cosapisoft.com.pe
>Thanks anyway
>Grettings
>Bruno
>
>.
>

help me with date

Hi i have date field. when used paratemized query from asp.net . in which
date field is null , it null the whole dynamix sql , then i decide to use
isnull function to convert null to '', i
like set @.mydate=isnull(@.mydate,'')
but this create another problem which it update date field with date
1/1/1900, but i want that field should be null instead of 1/1/1900 any one
has any idea how to do thatUse this option.
SET CONCAT_NULL_YIELDS_NULL OFF
Hope this helps.
--
-Omnibuzz (The SQL GC)
http://omnibuzz-sql.blogspot.com/
"amjad" wrote:

> Hi i have date field. when used paratemized query from asp.net . in which
> date field is null , it null the whole dynamix sql , then i decide to use
> isnull function to convert null to '', i
> like set @.mydate=isnull(@.mydate,'')
> but this create another problem which it update date field with date
> 1/1/1900, but i want that field should be null instead of 1/1/1900 any one
> has any idea how to do that|||or if its not in the dbend
then use DBNull.value
-Omnibuzz (The SQL GC)
http://omnibuzz-sql.blogspot.com/
"Omnibuzz" wrote:
> Use this option.
> SET CONCAT_NULL_YIELDS_NULL OFF
> Hope this helps.
> --
> -Omnibuzz (The SQL GC)
> http://omnibuzz-sql.blogspot.com/
>
> "amjad" wrote:
>|||amjad wrote:
> Hi i have date field. when used paratemized query from asp.net . in which
> date field is null , it null the whole dynamix sql , then i decide to use
> isnull function to convert null to '', i
> like set @.mydate=isnull(@.mydate,'')
> but this create another problem which it update date field with date
> 1/1/1900, but i want that field should be null instead of 1/1/1900 any one
> has any idea how to do that
Your dynamic SQL needs to set the date field equal to NULL instead of
''. Post the code that builds your dynamic query.

Friday, February 24, 2012

help me understand how to move the express database to live

im using the the login controls with asp.net

when i test locally everything works great, its see the ASPNETDB.MDF file, checks the login info and passes the user on to the next page.

However when i move the application to the live server it fails, it cant find the datasource that contains users/password etc. here is there error:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

So im missing something here, im used to connecting directly to a remote SQL database and accessing the info from there.

Can someone point me in the right direction? Can the MDF file not be used off the server itself without SQL express installed? Do i need to migrate those tables into a real SQL database?

Thanks,
Sean

update:

installed SQL express on the webserver and it seems to work better now.

I dont get the same error however the user can not login, each time i get "invalid login etc".

If i use the local debug mode it will login correctly.

:(

Any ideas where i need to look?|||

still no luck with this.

can anyone help me understand the process of moving a sql express DB to a production enviroment with SQL Server 2000?

help me set up msde

I just installed MSDE off of disk that came with teach yourself asp.net in 24 hours. To get the program started you must go to run and type cmd and wait for the C prompt. I get this far, but I can't get a C prompt. It always comes up C:\sql2ksp3> How do I get a C prompt from here. I know it must be something easy that I am just overlooking or forgot.
Thanks
Del Dobbscd \

not that is matters a lot.