Rectify The Error If(ds.Tables[0].Rows.Count > 0)?
Feb 22, 2011I create an one webpage in asp.net all the time i am facing the following pbm how to rectify it..
if(ds.Tables[0].Rows.Count > 0)
I create an one webpage in asp.net all the time i am facing the following pbm how to rectify it..
if(ds.Tables[0].Rows.Count > 0)
When a user submits the query to SQL when clicking a button I need to get a count of the number of rows that are returned. Which event does the gridview.count code need to be place in?
Right now I have it in the btn_click event, but in order to get it to count the rows you have to hit the button twice since the query is not returned yet. Here is my code.
[Code]....
[Code]....
In above query I want to have top 10 rows as well as count of all rows.
I've been using the Smtp server 127.0.0.1 .The error I get:
System.Net.Mail.SmtpException: Cannot get IIS pickup directory.at System.Net.Mail.IisPickupDirectory.GetPickupDirectory().
This Error occured ,when Email send from ASP web page.But EMail send from ASP.NET page,error is not occurred.
xml parsing error no element found location line number 1 column 1. If run every application this error come (in mozilla only). how to rectify this error.
View 1 Repliesin my code i use in the web config the following code
Code:
<compilation debug="true" strict="false" explicit="true">
<pages enableViewStateMac="true"/>
<machineKey validationKey="135265D42623958C1E84631D0AB327E8E43 3978BD4A28FC0A0CD71E38A5F3D4F950DD32034058613CBFF0 890211D4E6F4C6E79EDC6A522572B31F3583DC5D929" decryptionKey="FE65F6B07ACA419BC98EC59992702913509 ECDA570BDA0B86643F4EE21643671" validation="SHA1" decryption="AES"/>
i use this code because i had problems when 30 minutes of the last action were past then it didnt found the other pages of my project with this code it works fine
but i have a subfolder inside the project and there the problem still exists
i had a web config there then i tried to adjust the previous code inside this second web config but i took this error "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS."
I receive the error "No parameterless constructor defined for this object", I have read some post on this forum about this error, but i cannot get it to work.
ViewModel
[Code]....
Controller:
[Code]....
[Code]....
I have written the following code in Global.asax but I'm getting error The remote server returned an error: (404) Not Found in the
[Code]....
i created a web application by using Asp.NET webform, NHibernate to access Sql Server 2008 database and StructureMap as IOC Container.
Everything seem to work ok since few users use it; when user number increases (we can say 10+ users) webapp crashes with this error:
System.OutOfMemoryException
I downloaded redgate ants suite: the performance tool says that maximum cpu time is in NHibernate createSessionFactory for a GetAll request.
This is my NHibernateHelper object:
[code]....
I started an app in VS2008. I did it as a web site. I installed VS 2010 (yay) today. I wanted to start over as a web project. I made a Master Page. I made content pages. One of my content pages has a form on it. Super simple text boxes and submit.
I added a folder called App_Code and placed my class files there by doing Add New Item and pasting the code into the new class. I have person and persons. The persons collection class references person. In the same folder, the persons class finds the person class. Up one level in a page's code behind, I am gettingthe error
The type or namespace name 'person' could not be found (are you missing a using directive or an assembly reference?)
For giggle, I move person.cs up a folder. Still cannot find the person. Persons collection class still CAN find person. My code behind cannot find it.
A little reading tells me I have to set that folder as an app folder in IIS. I am running Windows 7 ersonal... I cannot find IIS. If not there, I ask myself what they heck is my app running under?
for being such a noob. Anyone know what is going on here?
Now I'm developing the autogenerated mail program in my web application system.
And there is my code :
[Code]....
My environment is using Microsoft Exchange Sever and if I send my company address each other, there is no problem.
(e.g: my email addrss is [URL] and receipent address is [URL]
But when I send to [URL] I mean any other external mail address, I cannot send... the error message appears like this :
[code]...
I am trying to count records belonging to a certain person in three different tables in a single select statement. The database looks like this:
Player
-PlayerId
-Name
Game
-GameId
-TournamentId
...
Goal
-GameId (FK->Game.GameId)
-PlayerId (FK->Player.PlayerId)
-Assist (FK->Player.PlayerId)
Card
-CardId
-GameId (FK->Game.GameId)
-PlayerId(FK->Player.PlayerId)
I want to select the number of goals, assist and cards a player has in a specific tournament. I tried with this query but then the goal and card column shows the sum of the number of rows matching the playerid in the Goal table and the Card table...For example if there is two matching rows in the goal table and three matching rows in the card table, I get 5 in both these columns in the resultset.
[Code]....
[Code]....
this is the code for login.aspx.vb it checks the username and password in the database and redirecrs to respective page on the basis of rows returned. i'm having problem in finding a right function in the sqldatareader namespace so that it counts the number of rows affected.
which part when wrong if my code is wrong ? I'm using VS2010 have a dataset. Here is my code. [Code]....
View 4 RepliesDoes anyone know how to count the no of rows in asp:GridView using jQuery. If no rows found then I want to do stuff...
View 4 RepliesI am working with visual studio 2010, ms sql server 08 R2, IIS 7.5, I am trying to connect to the database the following error appear every time I try to open the connection with the server:
Cannot open database "db" requested by the login. The login failed.
Login failed for user 'NT AUTHORITYNETWORK SERVICE'.
Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Cannot open database "db" requested by the login. The login failed.
Login failed for user 'NT AUTHORITYNETWORK SERVICE'.
Source Error:
[Code]....
Source File: c:inetpubwwwrootMS2010App_CodeNewsDTO.cs Line: 49 Stack Trace:
[Code]....
I have a web appliation , taht is developed using linqs to acess datasource and insert , update , delete data
and i have database ,
when i run this appliation in my system its work fine,
if i move this appliation to another pc, and i have database , when i run this application its not wrking
Cannot open database " xxx" requested by the login. The login failed.
I use below code in SP to count row of table and show it in label
ALTER procedure [dbo].[showMessage]
as
begin
SET NOCOUNT ON
select (select COUNT(id) from Message) as Message
,(select COUNT(id) from MessageM) as Messagem
end
[CODE] ...
Now I want define other label that shows total of these two table rows .I mean if in Message Table has 7 row and MessageM tabel has 8 row so
LblNMR =7 and LblRM =8
Now I want define LBLMAIN that in this label show LBLMAIN=15 total of 2 tabel Rows
How I can do it ?
I want to count the number of rows in Gridview ,thru JS. When SelectAll is executed,alert message 'a' is displayed,then page posts back to the server.1) It do not display the alert message gridLength 2)WHy the page is postbacked,I write return false???
Code:
function SelectAll()
{
alert('a');
var gvET='<%=GrdCostPetroleum.ClientID%>';
var gridLength = gvET.rows.length;
alert (gridLength );
return false ;
}
I have a data table called Songs It has SongId as Primary Key of type INT SongName of Type VarChar UserId of Type Int. I simply want to check how many entries are in the Table already by The UserId before they insert more. So If there are already 3 songs by that User, I want to stop the insert process and warn them they have the maxium already. I think i am halfway there already using code below but problem is that UserId is of Type GUID, and not Int so I am missing something. On my Aspx, Page, I have a DetailsView for the Database Insert. I also have the following code using BusLogic Layer and DAL
SongsBLL
public int ScalarQuery(Guid ArtistId)
{
int returnValue = ScalarQuery(ArtistId);
return returnValue;
}
Code Behind ASPX page
This in in DetailsView_ Item Inserting Event
SongsBLL number = new SongsBLL();
currentCount = Convert.ToInt32(number.ScalarQuery(currentCount).ToString());..........
my table has already 5 rows...after pressing addow, rows are added dynamically to another table... i need to save the data of all the rows(5+newly added) in the database...
View 2 RepliesI got error. rectify 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. 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.
I have 2 table's
Table 1: Daily_item
Fields: Key_Guid Drescription Count
1 test 3
3 new item 2
I want to insert records form table 1 into table 2 but using the count field to duplicate the Key_guid record the new table.
New table example:
Table 2
Key_guid
1
1
1
3
3
i am using sql 2005 db. i have created a table called attendance where i store employee attendance, i want to separate number of absence for a particular employee and particular month. It have to show number of absence of a particular employee and particular month. Also i have to count no of absence. for eg: if an employee absence for two days for a particular month, it have to display 2 count.. how to do this? also how to write the store procedure for this?
View 4 Replieshow to get the length of the gridview rows using javascript if we had a table inside the item template of gridview
View 1 Replies