|
I think it is showing you the error because you forgot to call Read()
also your query returns only UserID and you are reading whole row.
so change the
Select UserID FROM Members WHERE UserName=@username to
Select UserID,FirstName,LastName,CityId,CountryId,Mood FROM Members WHERE UserName=@username
in the LoadFromReader()
public void LoadFromReader(SqlDataReader reader)
{
if(reader.Read())
{
this.UserId = (int)reader["UserId"];
this.FirstName = (string)reader["FirstName"];
this.LastName = (string)reader["LastName"];
this.CityId = (int)reader["CityId"];
this.CountryId = (int)reader["CountryId"];
this.Mood = (byte)reader["Mood"];
}
else
}
also change the ExecuteScalar() to ExecuteReader()
because now you are getting more than one values.
|
|
|
|
|
thanx ....
will try with the changes ...
Apurv
|
|
|
|
|
Its working thanks .....
Apurv
|
|
|
|
|
Hi All,
I am developing a WebApplication using ASP.NET and C#.
there is a exception occurs when i call for a XmlWeb Service --Web Method.
This is the code.
try{
DataXML service=new DataXML();
service.Timeout = 10 * 60 * 1000;
object[] results = service.GetProductionData();
}catch(Exception ex)
{
str=ex.Message;
}
Here we have to wait around 100 seconds to get the response. But before that there is exception occurs and the error message says
'The underlying connection was closed: The connection was closed unexpectedly
So the client side returns a exception before results come. why is that??
can any one help on this?
Thanks in advance..
|
|
|
|
|
It is impossible to answer the way you have posted your question. Why don't you place a debugger in the method GetProductionData and see if there is a problem in that method or not.
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
Hi,
I have debugged the code. but I can not find a error. while I am debugging the XML Webservice method,client side displaying the error message.
why is that? Is it like timeout error?
|
|
|
|
|
Post the code of your webservice method.
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
I use the ajax.net stuff a lot, but some of its features are not as nice as those found in Scriptaculous/Prototype. However, I have found that if you try and use a mixture of both on a site, it can cause bugs, so I had to ditch the Scriptaculous bits and just use ajax.net.
Has anyone used any other frameworks along side ajax.net without problems? Just wondering if there is a more compatible one out there?
Words fade as the meanings change, but somehow, it don't bother me.
|
|
|
|
|
Not specifically with ASP.NET Ajax, but I have had problems - mostly stemming from the fact that every man and his dog seems to have overridden the $ character - we did to do document.getElementById, but scriptaculous had also grabbed it...
C# has already designed away most of the tedium of C++.
|
|
|
|
|
aspnet_regiis.exe -ga "Network service"
The above command grants "Network service" access to the IIS metabase and other directoriesused by ASP.NET.
Is there any way to do using "Security Identifieir"SID[^] instead of user name, actually it is useful in Localized OS.
Thanks,
Mushq
|
|
|
|
|
Hi.
I have todevelope a web site that it uses ssl.
Providing ssl is with customer.
Do I do any special work in my programming?
or I do my traditional work (design & programming) and finally up it such previous?
Best wishes
|
|
|
|
|
Well, SSL has nothing to with programming, it is related with deployment.
But, if you are sending links somewhere in application than keep in mind to select the protocol using code rather than hardcoding(http or https)
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Manas Bhardwaj wrote: if you are sending links somewhere in application than keep in mind to select the protocol using code rather than hardcoding(http or https)
I didn't underestand it! can explain it, please?
Best wishes
|
|
|
|
|
Just make your site as normal. You don't need to do anything in programming for deploying with SSL.
The pages which you want to be on SSL should be properly called like https://yourdomain/yourpage.aspx
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
|
You don't need to add any extra code for a SSL site. You should get SSL from a provider, install on your server and request page using HTTPS protocol. It's the secure HTTP connection.
|
|
|
|
|
You should first have an SSL certificate installed on your domain.
Then do something like this depending on your requirements:
Write a redirect script, that redirects all requests to your website to https://
<br />
<%EnableSessionState=False<br />
host = Request.ServerVariables("HTTP_HOST")<br />
<br />
if host = "your-domain.com" or host = "www.your-domain.com" then<br />
response.redirect("https://www.your-domain.com/index.html")<br />
<br />
else<br />
response.redirect("https://www.your-domain.com/error.html")<br />
<br />
end if<br />
%><br />
This script needs to be named default.asp and placed in the folder your domain is pointing to.
|
|
|
|
|
Hey guys, whats happening ?
I'm using a ObjectDataSource and link it to a class which contains a method for selecting from database i try to configure the data source but I cannot choose a business object, the combo box in the wizard is empty !!! my class is in App_Code folder so automatically it must be loaded in the combo bod in the configuration wizard !
Thanx
Mr.K
|
|
|
|
|
Your question is not clear. Please always make it clear. What is your problem and what you want to do.
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
I'm using an Object Data source ! I have a class in my APP_Code folder which includes methods for inserting data. I tried to use objectdatasourse's wizard but it doesn't read those classes in my app_code folder !
Mr.K
|
|
|
|
|
Hi
How would I select part of a string value.
For example if I had a string which said
"Room ID = jghdu"
and I wanted to select all text after '=', how would I go about doing that?
thanks!
|
|
|
|
|
string abc = yourString.SubString(yourString.indexOf("="));
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
just a addition
string abc = yourString.Substring(yourString.IndexOf("="));
abc = abc.Remove(0, 1);
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I get the following error when I put your code in:
StartIndex cannot be less than zero.
Parameter name: startIndex
System.ArgumentOutOfRangeException: StartIndex cannot be less than zero.
Parameter name: startIndex
why would this be?
|
|
|
|
|
because in your string you dont have '='.
you can do it this way
if(yourString.Contains("="))
{
//code i wrote previously
}
OR
if(yourString.indexOf("=") > 0)
{
//code i wrote previously
}
Ahsan Ullah
Senior Software Engineer
|
|
|
|