How To Display Error

Dec 16, 2007

 Hai,
         My condition of the program is to check whether the username is available or not. If it is available, I should insert that username into the db, if not I should display "Username already exists".
 
I've written SP for the condition, but I dunno how to display the error message in asp.net. I've my codings below:
 
DB - SP:
alter procedure insert_user

@username varchar(20)
as
if exists(select username from test where username=@username)
print 'Username already exists'
else
insert into test(username) values(@username)
 
Default.aspx.cs:
  protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection insertconn = new SqlConnection("Server=achuthakrishnan;Initial Catalog=classifieds;Integrated Security=SSPI");
SqlCommand insertcmd = new SqlCommand("insert_user", insertconn);
insertconn.Open();
insertcmd.CommandType = CommandType.StoredProcedure;
insertcmd.Parameters.AddWithValue("username",TextBox1.Text);
SqlDataReader dr;
dr=cmd.ExecuteReader();
insertconn.close();

 
What is the condition I should check after SqlDataReader dr? Or else, I believe I should use @@error to display error messages in asp.net. I googled a lot and couldn't find the exact solution. Can any one help me? 

View 9 Replies


ADVERTISEMENT

Why Does The Stored Procedure Display Error?

Feb 16, 2006

Why does the Stored Procedure display error?
I define a Stored Procedure Named Wish_DisplayTitleOfThing7, why does the Stored Procedure display error? Thanks!
Msg 156, Level 15, State 1, Procedure Wish_DisplayTitleOfThing7, Line 9Incorrect syntax near the keyword 'case'.
create procedure Wish_DisplayTitleOfThing7  @UserName varchar(80),  @Status int,  @Tag varchar(80)=null,  @CreateDate datetime=null  AS
 select * from Th_TopicTable where (UserName=@UserName)                                                    case @Status                                                       when 0 then ''  --All                                                      when 1 then ' And (CompleteDate is not null )'   --Completed                                                      when 2 then ' And (CompleteDate is null )'      --Uncompleted                                                   end                                                   case @CreateDate                                                      when null then ''                                                      else ' And (DatePart(year,@CreateDate)=DatePart(year,CreateDate))'                                                   end
 

View 11 Replies View Related

Display Error Message On Screen If No Value

Aug 9, 2006

I have a screen set up in another software package which accepts
2 values on a form -

'Number1' and 'Number2'

I need to check that at least a value is entered in one or both ...
If both values are 0 (set on dispaly of the form )then I need
to throw an error message to that effect on screen ....

(The Sql script is triggered after the form data has been entered)

Can anyone help me with the SQL script please to check the values ???

View 5 Replies View Related

Error On SQL Enterprise Manager Display

Jul 20, 2005

SQL Enterprise Manager Version 7.0, Windows XP professional version 5.1The list panels (right half of the screen) will not show the tables.The top of the panel reads: 245 items, which is correct, but the panelreads: there are no items to show in this view. This error is occurringon one database on one server. The tables are actually there but Icannot access them through Enterprise Manager.I assume that a re-install will probably fix it, but I'm hopingto avoid it.Help--Posted via http://dbforums.com

View 1 Replies View Related

Error In Display .rdl Report On Aspx Page

Jun 23, 2008

hi to all,

I am using Sql server reporting services.When i have create a report .rdl file and deploy it on Report server and than display that report on my application's .aspx page in pdf format using web services , every thing is perfactly working in my senario at the starting time but now i faced a problem with that. When record goes more than 2000 (in my senario a single record disply in a one report pdf page means for 2000 record in table that means its display in 2000 pdf page as with next forward option of pdf view),So in that cas it doesn't work, did now show any report and give the error as
ex.Message"Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.
The request failed with the error message:
--
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Server Unavailable
</title>
</head>
<body>
<h1><span style="font-family:Verdana;color: #ff3300">Server Application Unavailable
</span></h1>
<p>
<span style="font-family:Verdana;">
The web application you are attempting to access on this web server is currently unavailable.  Please hit the "Refresh" button in your web browser to retry your request.
</span></p>
<p>
<b>Administrator Note:
</b> An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.
</p>
</body>
</html>

--."string

Any body have any idea please help me as soon as possible.
urgently--- any help will be appriciate.
thanks in advance.
arvind

View 1 Replies View Related

How To Display Error Message(Reporting Services)

Mar 10, 2007

I have a report created in Business Intelligence Project.I want to trigger my report result. If it has no returned value, it creates error message displayed on the screen. How could I do this?
Any guidance please.

thanks
-Ron-

View 3 Replies View Related

Reporting Services :: Display Columns When There Is No Data To Display

Apr 30, 2015

I would like to display a portion of report where there is data or no data

There is data subreport  display   

     Product Name Latex Gloves  
     Product ID      
xxxx5678

 There NO data in the subReport
 
  Product Name                          
   Product ID    

View 3 Replies View Related

How To Display This?

Dec 7, 1999

I have a table with the following structure and data

SampleTable

id name parent_id
1 Microsoft 0
2 Visual Studio 1
3 J++ 2
4 VB 2
5 C++ 2

As you can see, a record with parent_id=0 is the top level. Other levels will have a parent. I want to display the above data as below

1 Microsoft
2 Microsoft - Visual Studio
3 Microsoft - Visual Studio - J++
4 Microsoft - Visual Studio - VB
5 Microsoft - Visual Studio - C++

I tried many times with the select statement but with no luck. Do you have any ideas? Thanks,

View 1 Replies View Related

Display Another Value

Dec 5, 2011

i have a column name "Principle" and the data in this column is a dollar value. How do i write a query where when the dollar amount is <0 it displays as - and when its >0, it displays as +

View 1 Replies View Related

How Do I Display The Day Name Instead Of The Day #

Apr 6, 2004

Hi,

I created a Time Dimension and ended up with the following (as shown in the attached image). The problem is that when I go to the Day level, I see numbers e.g. 1, 2, ..., 31. Instead I want to display the Weekday Name e.g. Monday, Tueday and so on (i.e. what we get with the datename(dw,<date>) function. Right?)

However I am not sure what to change and where in order to get the desired results. Can someone kindly guide me.

Thanks.

View 2 Replies View Related

How To Display..

Apr 21, 2008

Hi,

I need to show the value of a variable with comma seperated.

For eg: I have a variable N whose value is 123456.89
I need to display it as 1,23,456.89
How i can i display this...
Please help me

Thanks in advance

View 20 Replies View Related

How To Display?

Sep 18, 2007

Hi,

I have the following stored procedure

CREATE PROCEDURE dbo.test(
@number varchar(128) output
)

as
select @number = * from fix_lvts..fix_exec_reports
where gw_instance like '%PORTWARE%'
return 0


Then I go in and execute it like this:

declare @number varchar(128)
exec dbo.test @number output
select @number

I get the following result:


T_PORTWARE_GBL

(Only one row returns).


However when I execute the sql statement below:

select gw_instance from fix_lvts..fix_exec_reports
where gw_instance like '%PORTWARE%'

which is the same one as in the stored procedure except the variable declaration it reurns me the following:

gw_instance
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL

(99028 rows of data)


Why is this hapenning?

Can anyone help me?

Thanks and Regards,
Sudip

View 2 Replies View Related

How To Display

Mar 12, 2008

Hi,

My table "Branch" contain a Field name as MassMail
it contains mail IDs a@yahoo.com;b@yahoo.com;c@yahoo.com;d@yahoo.com;e@yahoo.com

Now plz write me what is the SQL Statement for Retiveing MassMail
except one or Two Mail ID
Example : Retrive
a@yahoo.com;b@yahoo.com;d@yahoo.com;e@yahoo.com

Here c@yahoo.com is not Include

Thanks

Thanks

View 2 Replies View Related

How To Display??

Sep 18, 2007



Hi,

I have the following stored procedure

CREATE PROCEDURE dbo.test(
@number varchar(128) output
)

as
select @number = gw_instance from fix_lvts..fix_exec_reports
where gw_instance like '%PORTWARE%'
return 0


Then I go in and execute it like this:

declare @number varchar(128)
exec dbo.test @number output
select @number

I get the following result:


T_PORTWARE_GBL

(Only one row returns).


However when I execute the sql statement below:

select gw_instance from fix_lvts..fix_exec_reports
where gw_instance like '%PORTWARE%'

which is the same one as in the stored procedure except the variable declaration it reurns me the following:

gw_instance
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL
T_PORTWARE_GBL

(99028 rows of data)


Why is this hapenning?

Can anyone help me?

Thanks and Regards,
Sudip

View 2 Replies View Related

How Do I Display A Count?

Mar 15, 2007

I want to display the number of records for each state in a database.  I'm using a strongly types dataset.  In my method, I have the followingSELECT     COUNT(ID) AS iTotal, STATEFROM         membersWHERE     (Suspend = 0)GROUP BY STATEORDER BY STATEIn the code behind of my page I have          Dim mateAdapter As New WAPTableAdapters.membersTableAdapter        Dim mates As WAP.membersDataTable        Dim mate As WAP.membersRow        mates = mateAdapter.GetDataState        For Each mate In mates            Select Case mate.STATE                Case "AK"                    LabelAK.Text = mate.ID.            End Select        Next  What should LabelAK.Text = mate.ID. be for me to be able to display the number of records that have 'AK' in the state field?Diane 

View 7 Replies View Related

Display ROW As A COLUMN

Mar 15, 2008

I am JOINing a Table with a View, and the View can have multiple rows relating to the join condition(i.e. My view as 4 columns, and can look like the following:
A  B C D
A E F G
B H I J
I want this to look like -
A B C D E F G
B H I J
I want one row, but not one column, I need to maintain each value in its own column, withinin a single row. 
Doesn't matter to me if that transition happens in my View or as the outcome of my Join.
I've been looking at the PIVOT command, but that appears to only work with an aggrgrate function. I don't want to calculate/aggreagte anything, just combine my multiple rows in one.  
This is my VIEW stmt -
SELECT     [PKG ID] AS PKG_ID, [APPR GRP NAME], [USRID OF APPR], [APPR STATUS]FROM         dbo.pkgapproversWHERE     ([APPR STATUS] = 'approved') AND ([APPR GRP TYPE] = 'E')
This is my Join stmt - set @sql = N'SELECT DISTINCT [PKG ID] AS PKG_ID, [ELM ACT] AS Action, [END EXEC DATE] AS "Exec Date", [COMMENT] AS Comment, [USRID OF APPR]
FROM [PkgAction]
FULL JOIN vw_PkgApprovals
ON PkgAction.[PKG ID] = vw_PkgApprovals.[PKG_ID]
WHERE 1=1'
 
Any thoughts....Thanks
 

View 7 Replies View Related

Display Of SqlDataSource

Mar 5, 2006

 I'm trying to follow along with lesson07 Web Development Express series and when I drag the SqlDataSource tool onto my form I do not see the object on the screen.  I therefore can not configure it until I have placed GridView object onto my form. I hope you can help me in how to view the SqlDataSource or inform me where I can get further information

View 2 Replies View Related

Display Of Images

Jan 22, 2001

I want to publish Images in an asp-web-page. How can I do that?

View 1 Replies View Related

Isql Display

Aug 9, 2000

Hi,
When I execute a script by using isql, it displays the number of statement executed. can anybody tell me how to turn this off (no display)?
Thanks,

Mark

View 1 Replies View Related

Display Each Of The Record

Jul 25, 2005

I want to know how to display only each of it where in my database for example the ProductItem got a lot of value of '1000' in it. i only want it to display once.

ProductItem | Name
1000 | ABC
1000 | DEF
1000 | HIJ
2000 | KLM
3000 | NOP

I want in my dropdownlistbox only display 1000, 2000, 3000.
I using the 'Select ProductItem from Product' for sure it will display 1000,1000,1000,2000,3000. So to filter it.

Thanks

View 7 Replies View Related

Display Any Database On The Web

Mar 6, 2006

Hello. I've been searching for a couple of hours online and can't quite seem to find what I'm looking for. I've found plenty of database administration programs, but that's not what I need.

I'm looking for a program (or online service or whatever) that has the ability to basically take any database I choose and display the information within on a web page in which others can access. Such as, if my company wants to take on a few other company's databases and have them log in to our server through the web to display information from their (and only their) database dynamically on the web, then this program allows me to set all of that up. Information could be formatted in tables, charts, etc., whatever the program is capable of. Is there such a thing and where can I find more information?

Thanks for everyone's help. :-)

View 14 Replies View Related

Display Top 5 Salesman

Mar 31, 2008

Just a straight forward question: In the SQL SVR 2000 Northwind database, how do I display the top 5 salesman? I would like to display the salesmen and the total amount of their sales to date. I have this as a starting point:

SELECT Employees.Country, Employees.LastName, Employees.FirstName, Orders.ShippedDate, Orders.OrderID, "Order Subtotals".Subtotal AS SaleAmount
FROM Employees INNER JOIN
(Orders INNER JOIN "Order Subtotals" ON Orders.OrderID = "Order Subtotals".OrderID)
ON Employees.EmployeeID = Orders.EmployeeID
WHERE Orders.ShippedDate Between '19970101' And '20051231'

It displays all the sales between the dates, I just need to work something that will total up the sales for each employee then list the top 5.

Thanx

View 4 Replies View Related

How To Display Blank?

May 4, 2004

Hello, everyone:

By default, SQL Server display "NULL" if there is no data value. How to display blank instead of "NULL"? Thanks a lot.

ZYT

View 3 Replies View Related

How To Display The Relationships?

May 11, 2004

Hello, everyone:

I have attached a new database from customer, and wanted to check the existing relationships. How to display these relationships? Thanks.

ZYT

View 2 Replies View Related

Display Record Of The Day

May 22, 2008

Hi Guys,

How do I display an item in a day? This is a featured product of the day. This will change everyday. I can do this in classic ASP but not in stored procedure.

Table:
This is just to give you an idea of the table
ID | ProductName | DatePosted
----------------------------------------
1 | item1 | 5/1/2008
2 | item2 | 1/2/2008
3 | item3 | 6/2/2007

and so on...

Can someone please help me?

Thanks in advanced.

View 12 Replies View Related

Month Display

Jun 5, 2008

This my procedure

DECLARE @Months table
(MonthName varchar(20)

)

INSERT INTO @Months
SELECT 'Jan' UNION ALL SELECT 'Feb' UNION ALL SELECT 'Mar' UNION ALL SELECT 'Apr' UNION ALL
SELECT 'May' UNION ALL SELECT 'Jun' UNION ALL SELECT 'Jul' UNION ALL SELECT 'Aug' UNION ALL
SELECT 'Sep' UNION ALL SELECT 'Oct' UNION ALL SELECT 'Nov' UNION ALL SELECT 'Dec'


SELECT m.MonthName,ISNULL(CallOutCharge,0) As 'CallOutCharge'
FROM @Months m
LEFT JOIN (SELECT Sum(FT.CallOutCharge) AS 'CallOutCharge', Convert(CHAR(3), CC.CompletedDate,109) As 'Month', month(CC.CompletedDate) As 'intMonth', Year(CC.CompletedDate) As 'Year' FROM HSSPMS_Tbl_Callcentre_Compliants AS CC
INNER JOIN HSSPMS_Tbl_LandLordFulltimeEmployee AS FT ON FT.ContractorCode = CC.ContractorCode And CC.FaultCleared='1'
WHERE FT.CreatedBy=@OwnerId AND FT.IsDelete='0' And Year(CC.CompletedDate)=@Year Group BY CC.CompletedDate)t
ON t.month=m.MonthName

This my Result

MonthName CallOutCharge intMonth
-------------------- ------------- -----------
Jan 0 NULL
Feb 0 NULL
Mar 0 NULL
Apr 0 NULL
May 767 5
Jun 0 NULL
Jul 0 NULL
Aug 0 NULL
Sep 0 NULL
Oct 0 NULL
Nov 0 NULL
Dec 0 NULL


But i need to display


MonthName CallOutCharge intMonth
-------------------- ------------- -----------
Jan 0 1
Feb 0 2
Mar 0 3
Apr 0 4
May 767 5
Jun 0 6
Jul 0 7
Aug 0 8
Sep 0 9
Oct 0 10
Nov 0 11
Dec 0 12


Any one help me

Regards,
Prabu R

View 2 Replies View Related

How To Display Qty 1 Time

Jan 7, 2015

I have a temp table that I would like to only display the Qty of 4 one time

The total Qty is 4

Part Fac Loc Lot Qty
===== === === === ===
8793 07 FG 111 4
8793 07 FG 122 4
8793 07 FG 113 4
8793 07 FG 144 4

I want to display Qty 4 so when I do a sum I do not get qTY 16

Part Fac Loc Lot Qty
===== === === === ===
8793 07 FG 111 4
8793 07 FG 122 0
8793 07 FG 113 0
8793 07 FG 144 0

View 2 Replies View Related

DATE DISPLAY

Apr 23, 2006

I have the following code
<html>
<head>
<title>Eye Contact - Century to Century</title>
<link rel="stylesheet" href="eye01.css" type="text/css" />
</head>
<body>
<form name ="" method = "post" action="">
<table width="100%" border="1" height ="85%">
<tr height = "15%">
<th>Date</th>
<th>Year Left</th>
<th>City Origin</th>
<th>Country Origin</th>
<th>Year Arrived</th>
<th>City Arrived</th>
<th>State Arrived</th>
<th>Filename</th></tr>


<?php
$db = mysql_connect("localhost","root","");
if (!$db)
{
print "error - Could not connect to MySQL";
exit;
}

$er = mysql_select_db("touch_art1");
if(!$er)
{
print "error - Could not select the database";
exit;
}

extract($_POST);

$query = "SELECT date, yr_left, city_origin, country_origin, yr_arrival, city_arrival, state_arrival, filename FROM story WHERE country_origin = '$search_country' AND pamapproved = 'Y' ORDER BY yr_left";
$result = mysql_query($query);

if($result)
{
while($column = mysql_fetch_object($result))
{
print "<tr align ='center'>";
foreach($column as $colval)
{
print "<td>$colval</td>";
}
print "</tr>";
}
}
else
{
print "Error on Query";
exit;
}

mysql_free_result($result);

mysql_close();
?>

<input type="hidden" name="" value="none">
</table><table height = "15%" width = "100%" border = "0">
<tr height="100%">
<td align="left" valign="top" width="50%" >
<embed src="images/home.svg" width="100%" height="100%" wmode="transparent" type="image/svg+xml" />
</td>
<td align="right" valign="top" width="50%" >
<embed src="images/back.svg" width="100%" height="100%" wmode="transparent" type="image/svg+xml" />
</td>
</tr>
</table>
</form>
</body>
</html>

I need to display the date as in MM-DD-YYYY. Can anyone help?

View 3 Replies View Related

Display Date

Nov 30, 2007

How would I display just the date in the dataset if I have the data with date and time like this 2007-05-02 07:14:48.000
I want to truncate/or something to the time and just display the date. How would I change my query.

SELECT usr_end_date,date_exp,usr_last_name, usr_first_name, usr_login,employeeid, displayname
FROM [OIM_FIX].[dbo].[OIM_USR] a, CORP_EMP_IDs b
WHERE USR_login = CAST(b.employeeid AS varchar)and
usr_end_date <> date_exp

currently it is returning the full date and time like this
2007-05-02 07:14:48.000
I want just the date like this 2007-05-02

I am using sql server 2005

Thanks,
Maachie

View 4 Replies View Related

Date Display

Jul 23, 2005

I have a table in SQL Server 2000 with have date/time columns anddisplays the dates as : 1900-01-01 00:00:00.000 which is fine, but whenI select the column through dreamweaver for an asp page to date isshortened to 1900-01-01 but I need to see the whole date / time fieldfor conversion purposes.Can anyone help ?Thanks in advance.

View 2 Replies View Related

SQL: How To Display Top 5 Then Sum The Rest

Apr 6, 2006

Hello,I would like to query the top 5 best companies' sales (total sales),then total the rest, what is the quickest and effective SQL to queryit?Thanks in advance

View 8 Replies View Related

Subquery And Display Help

Feb 22, 2007

HiI need to produce an excel output from SQL that showsemail - company name - producttype1, producttype2 (where the - denotesa change in column)basically i have a table the first line is the fields and the secondand third are the entriesemail - companyname - producttypeJoin Bytes! - xx - Product1Join Bytes! - xx - Product2


Quote:

View 2 Replies View Related

COUNT Many But Display Just Once?

Apr 23, 2007

Hi, I have a table that I insert a member's country into every timesomeone signs up. What I'd like to do is pull information from the DBsuch that I can see each country and the number of users from each.For example:Argentina 10Brazil 5Canada 3I'm having trouble writing the SQL for this...any suggestions?Thanks,Erik

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved