|
|
please help me evaluate >.<
the sql database consist of 3 attributes BrandID,Brand,Brandlogo
comm.CommandText = "select Brand from Brand where BrandID = @BrandID"; //select which data i want from the database
comm.Parameters.Add("@BrandID", BrandID); //add parameters to query
SqlDataReader dr10 = comm.ExecuteReader();
dr10.Read(); // Call Read before accessing data.
int id = dr10.GetInt32(0); //<== this part i dont quite get it becoz my result was supposs to be an string
CatName.Text = id.ToString();
dr10.Close();
if the above code have anything wrong please tell me where cause i tryed to run it and it still cant work
(p.s thansk to all those who have been helping me)
|
|
|
|
|
neodeaths wrote: int id = dr10.GetInt32(0); //<== this part i dont quite get it becoz my result was supposs to be an string
Then you use the GetString method instread.
Do you remember that the very first thing I asked you was what you were trying to do? You never answered that, so I still have no idea if the code is even remotely close to what it is that you are actually trying to do.
---
b { font-weight: normal; }
|
|
|
|
|
thx i finally got it haha it ended up it was suppos to be like this
comm.CommandText = "select BrandID,Brand,BrandLogo from Brand where BrandID = @BrandID";
SqlDataReader dr10 = comm.ExecuteReader();
dr10.Read();
string id = dr10.GetString(1);
CatName.Text = id;
dr10.Close();
thx to all those who have help =)
|
|
|
|
|
Hi,
I have a web application and users can register themselves on it.
I would like to have special URLs for each client that is a registered user, much like a friendly URL.
a good example would be the way myspace.com works...
a registered user can have www.myspace.com/joebloggs as their myspace url.
i have tried to get this to work but can only manage to get www.mywebsite.com/joebloggs.aspx to work.
I do this by having a custom 404 page then perform a database lookup based on the name and redirect to their page.
If i drop the aspx off the end IIS kicks in and shows its own 404 page.
Is their any way i can have it without the aspx on the end? so it would be www.mywebsite.com/joebloggs
I am using asp.net 1.1 with visual studio.net 2003.
Thank you in advance for any help.
Regards,
Guy
|
|
|
|
|
It sounds like you'll want to look into url rewriting. To get you started, here are a couple of articles that Google spit out for me:- Richard Birkby's article[^] here at CodeProject
- Robert Chartier's article[^] at 15 Seconds
- Jesse Ezell's blog post[^] on working around some common problems
Just for completeness, here[^] is the search that gave me those results. I hope that helps to get you started.
--Jesse
|
|
|
|
|
Have the real address be www.mywebsite.com/joebloggs/default.aspx and you can just do www.mywebsite.com/joebloggs/ and if you have the default document set to default, it works. You can even do query strings: www.mywebsite.com/joebloggs/?sec=2&page=3
|
|
|
|
|
surely that means i would need to have a pre-created directory with the name 'joebloggs' though???
i dont really want directories for each user i just want it to be dynamic.
Because there is only ever really one page called viewclient.aspx this accepts an ID as a parameter and shows the clients content based on the ID.
So to view joe bloggs client page i want to type www.mywebsite.com/joebloggs
Is this actually possible in asp.net?
im wondering if i could do it by changing the IIS error page for 404.
then checking the url asked for (the query) and then looking this up in the database.
anyone know if this type of technique would work and how to achieve it?
---Guy H ( ---
|
|
|
|
|
It is possible through the use of url rewriting, and in a much more efficient way then using a 404 error as flow control. I linked several articles to get you started in my initial reply.
--Jesse
|
|
|
|
|
Hi Friends,
Can any one let me know how we can implement security using MYSQL.
Creating user login.
though i have created user table and login and its working for me but I am facing problem.
How to sign out user. because when i sign out user he/she can user browser back button to view previous pages although he/she is logged off.
any article link or code will be appreciated.
thanks
Naveed Kamboh
|
|
|
|
|
Hi,
I have a web application(ASP.net) running in our local Network. I want to send some messages to all the clients those are logined in. Is it possible? I have no Idea, where to start? and how to do?
pls hgelp me . This is very urgent..........
(i can get IP address of each machine when they login. I have also winpopup control, which displays message in pop ups)
|
|
|
|
|
meetbinu2003 wrote: This is very urgent..........
It always is...
|
|
|
|
|
Hi there. Do you want to try submitting your question again? Looks like the <> angle brackets didn't come through. (You may want to check the box "Ignore HTML tags in this message" when you submit)
|
|
|
|
|
I'm new to ASP.NET and with my first experiment I've run into a bunch XML problems. First I found out that the XMLDataSource control does not support namespaces. Now this. I'm trying to use the XPath position() function from within a DataList control. Here is my code:
<asp:DataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1">
<ItemTemplate>
item # = <%# XPath("position()")%>. item price = <%# XPath("ele") %>
</ItemTemplate>
</asp:DataList>
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/cleancrash.xml" XPath="gpx/trk/trkseg/trkpt">
</asp:XmlDataSource>
unfortunately when my code runs the position() function returns "1, 1, 1". I expect it to return the number from within the node set. In my case I have 3 nodes in my set, so I expect it to return, "1, 2, 3". I am attempting to produce a numbered list of items from within my XML file. My XPath command XPath("ele") works correctly, and the Datalist does see that my set has 3 items.
1. Is position() the correct function to be using?
2. How can I get the results I am looking for?
3. Can someone explain to me how to correctly read the XPathBinder documentation (http://msdn2.microsoft.com/en-us/library/system.web.ui.xpathbinder.aspx). I cannot figure out what syntax it is looking for. I'd love to be able to figure this out in the future.
Thanks, -=STZ=-
|
|
|
|
|
I have code that stores the shopping cart in a session object. It works fine until recently when it kept throwing an 'object reference not set to an instance of an object' exception.
This is my code:
<br />
If HttpContext.Current.Session("ShoppingCart") Is Nothing Then <-- exception thrown here<br />
HttpContext.Current.Session("ShoppingCart") = New Lists.CartList()<br />
End If<br />
It seems to occur when called by this code
<br />
Dim _objCart As New Lists.CartList<br />
Public Sub New()<br />
_objCart = CartManager.ShoppingCart ' <-- this is session bit above<br />
End Sub<br />
Any help is appreciated here
|
|
|
|
|
You didn't chage the code and all of the sudden you are getting an error?
Try resetting IIS.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
I have no idea what the problem was but it has sorted itself out. Ya gotta love Windoze :p
|
|
|
|
|
Hai,
I added two asp.net 2.0 projects to my solution. i need to add reference of first project in the 2nd project. But i am not able to get any dll for the project, even after i run it. What is the problem here ?. Can anyone help
me ?
Thanks in advance
Phanindra...
|
|
|
|
|
How are you adding the reference? I'd reccommend using a "Project Reference" over manually locating and referencing the resulting DLL. By doing so, Visual Studio will take responsibility for finding the output DLL and binding the correct reference for you.
--Jesse
|
|
|
|
|
Alright, I've been working on a ASP.NET/C# web site "app" for the last few weeks, and I have some questions...
Is there any such thing as a global scope for the web page? I'd like to load a couple of lists from a database just one time, and I waat those lists globally available throughout the web site. The idea is to keep from hammering the database every time a certai page is displayed.
How is something like this accomplished? Can it be?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Each web application lives in a given HTTP Context. This context is global to all pages and code running within it. Within the context is a Session object and a Cache object, both of which can be used to store arbitrary data items. A page intrinsically exposes both, but they can also be accessed outside of a page by using the static Context property Current .
The Session object that can be used to hold data that is particular to a given user. It is tied to the user session, is visible only to that particular session, and will only live as long as the session.
The Cache can be used to hold data for all objects in a given context. The context cache is not tied to a particular session, is visible to all sessions within the context, and does not expire default (barring an IIS is restart.) To control the lifetime of data in the cache, there are several options for setting expiration policies.
I'd recommend that you check out the HttpSessionState and HttpContext objects in the MSDN documentation. Hope that helps to get you started.
[EDIT x2] Fixed readability.
--Jesse
|
|
|
|
|
you can make use of sessions
My name is suresh dayma. I have just completed my graduation in commerce with 69%. I have also done 2 years of Vocational Banking Course from Chetana college with 71%. I have done GNIIT Course from Bandra branch. I like to do programming
|
|
|
|
|
Cache.Insert("YourDataTable", DataSet.Tables[0]);
//To retreive the datatable
DataTable dt;
if (Cache["YourDataTable"] != null)
{
dt = (DataTable) Cache["YourDataTable"];
}
-- modified at 9:15 Wednesday 16th August, 2006
-- modified at 9:21 Wednesday 16th August, 2006
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
The second bit of code about the cache is more applicable to yourself - the cache can also be given dependencies so that it can invalidate itself if some kind of data store (file or DB) changes. Accessing the cache is considerable more performant than repeated hits to the DB.
Cache is global across the application - session is global to a particular user within the app.
|
|
|
|
|
Hello
Can anyone tell me the major diferences between 2003 and 2005 in ADO.NET i? where can i find a tutorial about this?
|
|
|
|