|
i dont know why tis application wont works...
it keep giving me the first records in the database and populate it twice, when i wanted both 2 different records to appear...
if possible help me debug this or give me some comments...
thanks in advance...
Dim aryTest(2) as integer
arytest(0) = 1
arytest(1) = 2
Dim objAdapter As New SqlDataAdapter
Dim objDs As New DataSet
Dim ojDataRow As DataRow
Dim objArrayList As New ArrayList
objCMDB = New cCMDB
Dim i As Integer
For i = 0 To 1
mobjcmd.CommandText = "SELECT Contract_Ref,Equipment_Status, " & _
"Technology_Refresh_Eligibility, Configuration_Item_Description, " & _
"Configuration_Type, Maintenance_Contract, Procurement_Vendor, " & _
"Warrenty_Ends, Warrenty_Period FROM tblCMDB WHERE" & _
"Configuration_Item_ID = "& aryTest(i) & ""
mobjcmd.SelectCommand = mobjcmd
objAdaptor.Fill(objDs, "tblcCMDBRecords")
objDataRow = objDs.Tables("tblcCMDBRecords").Rows(0)
objcCMDB.ContractReference = objDataRow.Item("Contract_Ref")
objcCMDB.EquipmentStatus = objDataRow.Item("Equipment_Status")
objcCMDB.TechnologyRefreshEligibility = objDataRow.Item
("Technology_Refresh_Eligibility")
objcCMDB.ConfigurationItemDescription = objDataRow.Item
("Configuration_Item_Description")
objcCMDB.ConfigurationType = objDataRow.Item("Configuration_Type")
objcCMDB.MaintenanceContract = objDataRow.Item("Maintenance_Contract")
objcCMDB.ProcurementVendor = objDataRow.Item("Procurement_Vendor")
objcCMDB.WarrentyEnds = objDataRow.Item("Warrenty_Ends")
objcCMDB.WarrentyPeriod = objDataRow.Item("Warrenty_Period")
objArrayList.Add(objcCMDB)
Next
MobjCn.Close()
Return objArrayList
i@@
|
|
|
|
|
You need to recreate the new objcCMDB object in the for loop statement, otherwise it will overrite the current object.
|
|
|
|
|
thx dude thx for ur help... u save me...
|
|
|
|
|
Ok, this has me stumped. I am trying to get a single record from the DB, which may or may not be NULL.
Dim cmdSelect As New SqlCommand("SELECT weblink FROM dbo.environment WHERE id = 7, sqlDB)<br />
sqlDB.Open()<br />
<br />
sqlRead = cmdSelect.ExecuteReader<br />
<br />
If Not sqlRead.IsDBNull(0) Then<br />
'...Do something with result<br />
Else<br />
'...Do something with NULL<br />
End If
Yet when I do the test using 'If Not sqlRead.IsDBNull(0) Then' , it throws and error: Invalid attempt to read when no data is present.
Yes, I know theres nothing there, thats what I am trying to test.
I cant find anything about how this should work, all examples seem to expect data to be coming back. Help!
|
|
|
|
|
You must call sqlRead.Read() first.
Kelly Herald
Software Developer
MPC
|
|
|
|
|
Oh that was easy, thanks! I would have thought the .ExectueReader command would have sorted that out, but obviously not..
|
|
|
|
|
I have a regular ASP.NET TreeView control on my page that is auto populated from an XML file using DataBindings. In the SelectedNodeChanged event handler routine, I have it make the text of the selected (clicked) node bold.
My problem is: It doesn't matter which node I click on, it always bolds the top most node in that level of the tree. It never bolds the node I selected unless it is the top most node of a level.
It appears as if the page is doing a postback to the server (as it should). But I am not sure if that is the issue. How do I make it so that the node I click on stays "clicked".
Here is what I am talking about:
If this is my tree (below) and I click on "VBScript" it bolds "XML" when it should actually bold "VBScript".
Main
XML
XHTML
Visual C++
Visual Basic
VBScript
UML
PS. Is there a way to implement a control-click event for the TreeView control?
-- modified at 18:59 Wednesday 21st June, 2006
|
|
|
|
|
Do the TreeNodes have the same value? Make sure they should have different values for each node
|
|
|
|
|
That was the problem. Thanks for the tip.
|
|
|
|
|
I am trying to add an Event Procedure to a text field such that pressing the ENTER keyboard button activates the same procedure as clicking the submit button on the form. Apparently asp.net's textbox control does not have an ability to generate those kind of event. Or is there any way to do this?
Thank you
|
|
|
|
|
You can write a javascript function that gets called on the client-side onkeydown (not onkeypress) event. Check that if the character pressed is 13 (ENTER) then submit your form.
Hope that helps.
"Democracy is two wolves and a sheep voting on what to have for dinner" - Ross
Edbert
Sydney, Australia
|
|
|
|
|
I don't get the loading of an EditItemTemplate to work.
When I try to get the TextBox with FindControl from within the editTemplate I get the error message "Object reference not set to an instance of an object".
When I simply add the editItemTemplate in the .aspx-file it works fine, but not when it's loaded from file. This is how my code looks like:
<code> protected void Update_command(Object sender, DataListCommandEventArgs e)
{
error---> row["Description"] = ((TextBox)e.Item.FindControl("txtDescription")).Text;
}
protected void Page_Init(object sender, EventArgs e)
{
//om man är inloggad skall man ladda in ett annat template för datalistan med ändra-länk
if (Session["loggedIn"] != null && (bool)Session["loggedIn"] == true)
{
listItems.ItemTemplate = Page.LoadTemplate("productItemTemplate.ascx");
listItems.EditItemTemplate = Page.LoadTemplate("productEditItemTemplate.ascx");
}
}</code>
content of file productEditItemTemplate.ascx:
<code>Change article:
<asp:TextBox ID="txtDescription" runat="server" Text=' <%# Eval( "Description") %> ' ></asp:TextBox><br />
Image file: <asp:TextBox ID="txtImage" runat="server" Text=' <%# Eval("Image") %> ' ></asp:TextBox><br />
Price: <asp:TextBox ID="txtPrice" runat="server" Text=' <%# Eval("Price") %> ' ></asp:TextBox><br />
<asp:LinkButton ID="btnOk" runat="server" Text="OK" CommandName="update" />
<asp:LinkButton ID="btnDelete" runat="server" Text="Delete" CommandName="delete" />
<asp:LinkButton ID="btnCancel" runat="server" Text="Cancel" CommandName="cancel" /></code>Grateful for any help on this subject!
Gulllet
|
|
|
|
|
Because the FindControl method looks for the specified control within the scope of the naming container which you call the method. Here, you place the textbox control in a web user control which is a naming container, so you need to get reference to the user control before calling the FindControl:
e.Item.Controls[0].FindControl("txtDescription")
|
|
|
|
|
Yeah, that works fine. Thanx!
Gulllet
|
|
|
|
|
One of my websites has several hundred pages designed using old fashioned ASP. I'm now trying to add new pages/functionality using ASP.NET 2.0.
For the most part, this integration is going smoothly.. the one thing I'm really struggling with is cookies. The website has a "members" section and all member pages check for the existence of a specific cookie - if it's null the user gets redirected to the login page. The login page, which creates the cookie is done using old ASP, and I just can't seem to figure out how to check for the existence of this cookie using ASP.net code on my "new" pages - I keep getting an "Object reference not set to an instance of an object" error. The code I'm trying to use is:
If IsNothing(Request.Cookies("Member")("ID")) Then
' move to login page
End If
I'm guessing the solution is fairly simple, but it's eluding me so far. Any advice would be much appreciated.
|
|
|
|
|
From what I read ASP cookies are HTML-encoded, so you need to HTML-decode it first before using it in ASP.Net.
Try checking whether the "Member" cookie is null or it has some encoded values.
Hope that helps.
"Democracy is two wolves and a sheep voting on what to have for dinner" - Ross
Edbert
Sydney, Australia
|
|
|
|
|
I have an XML Control that takes its datasource location from the query string.
but i only want it to be able to open XML files from a certain folder on the server.
At the moment I use crpytography to make sure only links on the page (that link to the files i want it to be able to open)can pass these vales via URL to the query string.
Though i was hoping there was a simpler way to do this like control what files the XML can open files from.
|
|
|
|
|
Hi im new to ASP .NET and have to build an application that is a heavily data-driven website. More specifically the data from the application will update a image in real-time about changes to devices on a network (each device with be represented in the image (webpage) and change accordingly (e.g transition from green to red if there is a problem with it etc. So my question is could some one point me in the direction of a tutorial for making using cool graphics in ASP .NET, or point me in the direction of a tutorial/code that shows how to link ASP .NET with Flash (ACTIONSCRIPT).
Any help much appreciated.
FZ.
|
|
|
|
|
You may like to consider SVG - Scalable Vector Graphics....
I've been using this quite a bit recently for two main reasons - 1) it's VERY simple to get some really nice looking UIs and effects etc, and b) it can be scripted with any scripting language, and has build in suport for animation / attribute modification via script.
It does have its drawbacks - for instance, need an SVG viewer installed on the client (same for flash I guess), and unfortunately, there's no way to include "inline" SVG in other docs - have to use the <embed /> tag or an iFrame and a standalone SVG file. Having said that, I'm part of the way through a set of tools to simplify this stuff - basically a js lib that manipulates the DOM to add elements, and a ServerControl that does similar from the server side...quite straightforward to impl....
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
I am a novice in programming. Can somebody tell me how to capture a set of log files. Following is the scenario.
The log files reside in a directory on C drive. These log files roll every 3 months.
I need an utility which when double clicked comes up with a box asking for start date and end date and produce those reports within that period. Then these reports should be exported into excel or access.
Is this possible?
|
|
|
|
|
Fairly straightforward - you can use the various filesystem classes to get the files, but you'd have to use the object model for Excel to insert, or ADO / ADO.NET to squirt to Access - MSDN is the place to look
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
As I said, I am very new to programming, Could you give me an idea about how to do this. Or atleast direct me to the programming software, books to buy.
Thanks
sujay
|
|
|
|
|
Hi,
I use the Select html tag and I want to disable some of the options.
I use the disabled attribute and it works fine with fireFox but not in IE.
Can someone help me? (BTW, I want to avoid JavaScript becaus some users may disable JavaScript)
Thanks,
Yossi
|
|
|
|
|
That functionality is not implemented in IE.
MSDN on Disabled property for option and optgroup:
"The disabled attribute can be set and retrieved. However, the functionality specified by the HTML 4.0 standard is not implemented for this property."
I suggest that you replace the value for the disabled options with a specific value, for instance -1. Use javascript to check for the value, and also check the value when the form is posted to the server in case Javascript was disabled.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I'm try to call a webservice for a asp.net 2.0 page and it works ok...
except for the first time I call the webservice after a have build the application...
I recive a exception Response is not well-formed XML...
Can somebody tell me why this happens?
it only happens the first time after that it works fine...
Obs: I'm using a plug-in WebApplications insted of WebSites.
|
|
|
|