
a1jit
Avatar/Signature-
Posts
89 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by a1jit
-
I am having a problem doing the following in generics. I have one custom type array. Its a struct with few elements in it like id, shortname, longname Sample data would be 1, a, australia 2, a, asia 3, b, bangkok The problem im facing is that i want to actually gather all unique shortname and place it in another List (generic) I plan to create another new List, and then check whether the element exists in the new List, if not add it, else, move to the next item So i plan to make use of the Exists method in generic (List) but seems like im not sure how to use it since it has predicate. I hope the above explanation makes sense. Does anyone have some idea of how I might go about this? Any help (particularly example code) would be much appreciated.
-
Hi Gill Thanks for the reply, but how its normally done in a normal situation. Lets say we take a web application for an example, do me connect & disconnect everytime we need to pullout something from the database? Or we do it once during the login page and use it across the page until connection is idle for certain time?
-
Hi Guys, I need some example code or guidance here. Below is the description of my problem. ------------------------------------- I have a web service with couples of web methods, example is like 1) getNames 2) getLectures 3) getClasses, etc.. So in each of this method, there is a statement which connects to database, meaning whenever user calls "getNames", it connects to db, then retrives the data, release the connection. Then if user calls "getLecturers" again, it connects to db, then retrieves the data again, and releases the connection again. Im trying to eliminate the need of connecting to db for several times each time a web method is called I plan to have two additional webmethods. 1) connect 2) disconnect Meaning each time any developer wants to access this web service methods, they have to call the "connect" method, and then it will create a session of connection, and they can use a list of web methods, once they have finished, they call the "disconnect" web method. Im not sure how to implement this, i want to only connect once and make the connection last for several minutes until its idle for certain time.. Really appreciate if someone can point out an example or reference on how can i implement this logic.. thank you very much..
-
Hi Guys, I have a custom treeview and additional treenodes properties defined. One of them is StatusType of type enum Actually the issue im facing is when i click a certain node, i want to go up to its parent and check if the StatusType is equivalent to "CAnalysis" for example, if its "CAnalysis", then extract some information and pull out some content. Otherwise, it should go up another level up till the root to find for the "CAnalysis" Status Type. I know how to determine the parent of a node by using the "node.parent" property, but i dont know how to write a looping mechanism to search for the parent of a parent for instance. Any guidance would be greatly appreciated, thank you very much
-
Casting subclass to its baseclass to retrieve its data members value
a1jit replied to a1jit's topic in Visual C# .NET
Hi Guys, thanks a lot for the reply, im not sure why the casting is still not working.. Actually this is wht im trying to accomplish. Im creating a few custom classes to represent each level of nodes..So im just trying to detect the type of node when the user try to expand the tree. So according to the type of node, then i know which value should be loaded as its child. I dont want to use the depth level as its very rigid, and its not good if there is a change need to be implemented in future. So i want to create something similar to the link shown below in asp.net. If anyone has some idea, hope you dont mind sharing it with me. Thanks al ot http://www.devcity.net/Articles/23/1/custom_treeview.aspx -
Casting subclass to its baseclass to retrieve its data members value
a1jit replied to a1jit's topic in Visual C# .NET
Its of type TreeNode..But in previous version, im able to do this kind of casting..because im just converting its type to its subclass which is the concept of OOP..Am i right..I dont think there is a syntax issue with this statement..What is your opinion on this..This type of casting is possible right? -
Hi Guys, Im not so sure why this code throws out an casting error since this feature can be implemented in vs 2003 but not in vs express 2005.. Basically i have a class which is inheriting the TreeNode class public class DGTree : TreeNode { private string groupName; public DGTree() {} public DGTree(string groupName, string text) { this.GroupName = groupName; this.Text = text; this.NavigateUrl = "index.aspx"; this.PopulateOnDemand = true; } public string GroupName { get { return groupName; } set { groupName = value; } } } Then, somewhere in the aspx page, im using the above class to create a treenode DGTree parent = new DGTree("CAnalysis", "Fabrication"); TreeView1.Nodes.Add(parent); DGTree parent1 = new DGTree("CAnalysis", "Assembly"); TreeView1.Nodes.Add(parent1); Everything works fine..But when i try to retrieve the value of GroupName attached to each node using the event "TreeNodePopulate", i get some casting error. It seems like its not possible to cast the TreeNode Class to its subclass to retrieve its member values (GroupName) Error: Unable to cast object of type 'System.Web.UI.WebControls.TreeNode' to type 'DGTree'. protected void TreeView1_TreeNodePopulate(object sender, TreeNodeEventArgs e) { DGTree node = (DGTree)e.Node; populateChildren(node.GroupName.ToString()); } Im not sure why, but this same approach works in the .net 2003, but no idea why it doesnt work in express edition 2005, am i missing something?
-
Hi mskeel, thanks for pointing out another solution..seems simplier for .net2.0..thankss..
-
Cags, U r just greatttttt...thank you sooo much for guiding me through up to the solutions..thank you very very much..u r a great programmer.. I reallly appreciate it..thanks a millioonnn cags..thankss
-
Hi Cags, thank you very very very much..you have really helped me alot.. i seems the value is going in properly.. but i try to retrieve it, but im not sure im retrieving it the correct way.. the web service seems to show page cant be displayed after executing this statements below.. foreach (CAnalysisFieldCollection CAF in CAnalysisNames) { double id = CAF[0].id; string fullname = CAF[0].fullname; } How do i actually loop back the items in CAnalysisNames? thamk you alot again..
-
Hi Cags, thank you very much for pointing out the code..would appreciate if you are able to provide some explanation for the "public class CAnalysisFieldCollection : CollectionBase" And just have 2 questions, 1) what is the declaration for myCollection object? 2) How do i return the array back to the function? Initiality this is what i did. public RuleDbDataTypes.CAnalysisField[] processAnalysesNames() { RuleDbDataTypes.CAnalysisField[] AnalysisNames=null AnalysisNames = new RuleDbDataTypes.CAnalysisField[]; while (reader...) return CAnalysisField; } thanks a million..
-
Hi Cags, thanks for the quick reply..would appreciate if you have a short example of strongly typed array so that i can get a better picture of it. thank you very much
-
Hi Guys, I have been working on this for the past few hours but cant seem to get it right.. I have a web service..and i plan to use the dynamic array for array declaration I have a struct like below public struct CAnalysisField { public double id; public string name; public string fullname; public string description; } And below is my code to loop through data reader. public RuleDbDataTypes.CAnalysisField[] processAnalysesNames() { RuleDbDataTypes.CAnalysisField[] AnalysisNames=null;int i=0; OracleConnection con = databaseLogon(�x�,�x�,�x�); OracleDataReader reader = processORA(con,constructSQL(ConfigurationSettings.AppSettings["getAnalysesNames"])); //AnalysisNames = new RuleDbDataTypes.CAnalysisField[]; // find way to create dynamic array while (reader.Read()) { AnalysisNames[i].id = reader.GetDouble(0); AnalysisNames[i].name = reader.GetString(1); AnalysisNames[i].fullname = reader.GetString(2); AnalysisNames[i].description = reader.GetString(3); i++; } databaseLogout(con); return AnalysisNames; } The problem is that i dont know how to create a dynamic array and keep appending the array size as the record goes in. I dont want to execute a separate query to get the count(*), as it will take extra time, and i feel its good if we can change the size of array dynamically.. thank you very much for any help..
-
Hi Guys, I have been finding for this answer for quite some time but fail. My question is that can we control that xml output from a web service? Let me explain I have a small method like this in my web service public decimal AddNumbers(decimal lnNumber1, decimal lnNumber2) { return lnNumber1 + lnNumber2; } After data is keyed in, i automatically get this format. <?xml version="1.0" ?> <decimal xmlns="http://tempuri.org/">32.12</decimal> So here, can i change the xml format in a web service? Maybe i want this format <?xml version="1.0" ?> <number1> 2 </number1> <number2> 3 </number2> <results> 5 </results> This is just a sample, i want to do something like this, but it seems web service doesnt allow me to do this. I hope someone can provide me with some useful links,suggesstions or codes on how to do this.. thank you very very much for any help
-
Hi Guys, I have a few aspx pages which returns xml results.. Meaning user will send a url through external application and it will return xml results in an aspx page. For ex: user might send a url like : http://10.20.2.2/fol/getNames.aspx And this page might return some data in xml format like the following <names> <name id = "1" name="john" age="20" /> ... </names> So the flow is : User send URL -> XML Results return to aspx page -> apply xslt -> return html My question is that how can i apply xslt to this getNames.aspx so that it converts the data into some html format table? thank you very much for any sugesstions/ideas
-
Hi, thanks for the reply, Actually i have an image stored in some folder. for example, lets name it x.gif I want to call the image when user invoke the xml page. Meaning lets say users invokes test.aspx, this page will basically display to user some data in xml form , and in one of the xml element, i want to display this image, Meaning instead of having only text based elements, i want to be able to embed a picture in the element..Is this possible? Meaning lets say i have the following xml structure - <analyses> <analysis id="1" name="Fabrication" fullName="Fabrication Analysis" /> <analysis id="21" name="Assembly" fullName="Assembly Analysis" /> </analyses> How do i create another attribute, "picture" for example, and displayed the picture there, meaning this is the result i wish to achieve - <analyses> <analysis id="1" name="Fabrication" fullName="Fabrication Analysis" image="somerealimage" /> <analysis id="21" name="Assembly" fullName="Assembly Analysis" image="somerealimage" /> </analyses> the image attribute will basically have a image there. meaning user will not see any text for the "image" attribute, they will see a real image there
-
passing null value as an argument to a function
a1jit replied to a1jit's topic in Database / XML / Reporting
yup, i tried but didnt work, returned an error.. -
Hi, Im using framework 1.1, i was just wondering how can i pass a 'null' value to a function, because im retreving some data from database and some column might contain nulls, so how can i pass this null value to the function for further processing Some poeple recommend to use an "illegal" value and have that represent null. like use something like "-1". I plan to avoid the need of using -1 and other characters since if the column is "-1" , it brings up another meaning. If there any other way of passing null besides using an "illegal" value and then converting it back to null in the receiving function?
-
hi, i plan to display the actual image in the xml Meaning when user request for a particular xml page, it displays content, plus the image in a specific element. So how can i embed a picture in an xml element? Would really appreciate if someone could show an example here..thank you
-
Hi Guys, I have been browsing through the net and tried finding some examples to get an image displayed in an xml tag, some say use xlink and some say use xslt.But did not manage to get it done.. I have the following xml structure writer.WriteStartElement ("image"); writer.WriteAttributeString ("display",""); writer.WriteEndElement(); How can i insert an image in the "display" attribute tag? Thank you very much
-
Hi Guys, In asp.net, lets say i have the following url URL = "http://localhost/RuleDatabaseAPI/getTechnologyClassName.aspx?group=Assembly&subgroup=Fiducial Analysis" If i issue the following command Request.QueryString["group"] I get "Assembly" If i issue the following command Request.QueryString I get the whole url back What if i have to get all the list of parameters Meaning i want to know list of parameters being sent If i take the above url as example, is the any command which return to me "group" and "subgroup" since that are the only two parameters in this URL Thank you very much for any help..
-
thanks for the support guys, really appreciate it..
-
no i mean, the code above reads the source . meaning it includes the html tags and the data that is in the webpage, so what i plan to do was just to read the body content..meaning lets say this page, i just want to read what is see here, in this page, so i dont want to read the codes to build this page, but i want to read the values on this page (data)..hope i did not confuse you..
-
i see, thanks a lott for all the help, is there any way to convert your code to read the content of the webpage rather than the source code itself..thanks..
-
Oh ok, sorry for the posting in wrong section, yea, thats the code i was looking for, thanks.. but i got a small error, that is "use of unassigned local variable 'myReader' Not sure what shall i assigned it to..Any idea? thanks a lott