|
Name is reserved? Bah.
Well I've changed the field to Job now. and I've tried both:
"SELECT * FROM TheLog WHERE job='123' AND recdate=#01/02/2003#"
And
"SELECT * FROM TheLog WHERE [job]='123' AND recdate=#01/02/2003#"
Neither of them work.
This does work however:
"SELECT * FROM TheLog WHERE job='123'"
- Munty
|
|
|
|
|
Hi,
This may be a stupid question, but I'm having troubles assigning a hex value to the backcolor of a table cell with code.
I'm currently adding values into a table with code, but I would like to change the back color by giving the color's hex code or #code.
In the visual designer I can easily add the hex code, why not with code or am I forced to split it into blue, red and green or just use the basic system.drawing.color choices?
Hope someone can help
Kind regards
|
|
|
|
|
You create a Color value using the FromArgb method:
SomeTableCell.BackColor = Color.FromArgb(0xffff00); // yellow
or
SomeTableCell.BackColor = Color.FromArgb(0x80, 0x80, 0x80); // grey
---
single minded; short sighted; long gone;
|
|
|
|
|
Thank you, it works.
I just had to use '&H' instead of '0x' for VB.
But it works great, thank you for the help
|
|
|
|
|
Hi all,
I'm loading the meta tag values form the database for the description and the keywords, but its not doing what I want it to.
Currently I have the following
<meta name="keywords" content="<%=Keywords %>" />
Keywords being a property in codebehind, but if I view the source of the page when I run it, it displays the content of the tag as follows & lt%=Keywords %& lt
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
You can use the headers property of the page to add information to meta tags, for example
Dim meta as new HtmlMeta()
meta.Keywords = "test, stuff"
Header.Controls.Add(meta)
Try taking a look at that and if you get any problems post back
|
|
|
|
|
Thanks for the reply, What I did was added the runat attr to the meta tag, and then in the code behind I just used metaId.Content and assign the property to that
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
You can try it using a method that returns the keyword.
<meta name="keywords" content="<%=GetKeywords() %>">
public string GetKey()
{
return keywords;
}
|
|
|
|
|
Hi there,
I've got a TreeView like below
1
1.1
1.2
1.2.1
1.2.2
1.2.3
1.3
2
The code in SelectedIndexChange event like below
TreeNode currentNode = TreeView1.SelectedNode;<br />
TreeNode parentNode = currentNode.Parent;<br />
<br />
currentNode.Select();<br />
<br />
if (parentNode != null)<br />
{<br />
Response.Write(parentNode.ChildNodes.IndexOf(currentNode));<br />
}<br />
else<br />
Response.Write(TreeView1.Nodes.IndexOf(currentNode));
If I clicked 1.2.1 or 1.2.2. or 1.2.3, the page would say the index of the node I've cliked right.
If I clicked 1 or 1.1 or 1.2 or 1.3 or 2, the page would say the index of the node I've clicked is 0.
I don't know why, the index of 2 should be 1, index of 1.3 should be 2, ... but it wasn't correctly.
Anyone help me solve this issue.
Thanks.
|
|
|
|
|
|
I think you are looking for the documents tab in the IIS manager. This is where you set the start page of your site. It usually defaults to default.htm. So whatever you want your start page to be, you need to add it and put it at the top of the documents.
Hope that helps.
Ben
|
|
|
|
|
i solved, not enought to prohibit VS 1.1
I also changed file extensions compability from Configuration menu at properties of default web site.
|
|
|
|
|
I am using datatable in my application to show the data in gridview.Now what I want is that when user enter a new line application should check the datatable.if the record exists then it should show a warning otherwise add a new row in datatable.
I am using the following code to check the datatable through loop.
Dim x As DataRow
For Each x In mydatatable.Rows
If x.Item(1).ToString = Me.TextBox1.Text Then
Me.Label1.Text = "Exist"
End If
Next
With the above code I am getting error 'Object reference not set to an instance of an object.' at the first row of the for loop
Ejaz
|
|
|
|
|
Wow - TextBox1 and Label1 are variables in production code ? That's pretty grim.
Please don't crosspost. Where you asked in the VB.NET forum is probably the best place for this, as it doesn't directly involve ASP.NET.
Obviously you have a Row which doesn't have 2 items in it. It's always good practice to test your assumptions, as in
if x.Items.Count > 1 && x.Item(1).ToString = Me.TextBox1.Text Then
something like that.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I wrote code in the Application_End and Session_End in the Global.asax file
but i don't know how to invoke this code
i close the page and none of the 2 methods are invoked
|
|
|
|
|
Session_End --
closing the page doesn't end the session. Even after closing the browser window session can be still active till the session time-out is reached.
Application_End --
application ends when the web-server is stopped or restarted or web.config file is updated/changed.
Regards
John
|
|
|
|
|
can someone please help me. I've gotten all my code to work but my actual delete part. I've tried to fix it but i can't seem to fix the problem what i do just doesn't make any difference.
the code is:
<%
dim strSQL
if request.QueryString("ProductID")="" then
dim rs
set rs=server.CreateObject("ADODB.Recordset")
strSQL="SELECT * FROM Products"
rs.Open strSQL, oConn
response.Write("")
while not rs.EOF
response.Write("")
response.Write("")
response.Write("")
rs.MoveNext
response.Write("")
wend
response.Write("" & rs("ProductID") & " | " & rs("ProductName") & " | " & rs("SupplierID") & " | " & formatcurrency(rs("UnitPrice"),2) & " | Delete | ")
rs.Close
else
//the problem is below somewhere
strSQL="DELETE FROM Products WHERE ProductID=" & request.QueryString("ProductID")
oconn.execute strSQL //the error message says this part
response.Redirect("DeleteProduct.asp")
end if
oconn.close
%>
thanks
Robbie
|
|
|
|
|
well, what is the error message you're getting ? That might help....
Is this an Access db? I can't remember, it's been so long since I used Access, but don't you have to say "delete * from..." in Access, not just "delete from..." ? I could be wrong on that...
|
|
|
|
|
This is ASP code, as you said. This is the ASP.NET forum, the Web Dev forum is a better place to ask this.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
What does request.QueryString("ProductID") come in as - is it a string?
|
|
|
|
|
I have created a web user control with a drop down for "Main Categories" in it and a place holder.
<asp:UpdatePanel ID="pnlcategories" runat="Server">
<ContentTemplate>
<asp:DropDownList runat="Server" ID="ddlCategory" AutoPostBack="true" OnSelectedIndexChanged="ddlCategory_SelectedIndexChanged"></asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="pnlsubcategories" UpdateMode="Always" runat="Server">
<ContentTemplate>
<asp:PlaceHolder runat="server" ID="plhCategories" EnableViewState="true"></asp:PlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>
In the page load, i am populating the main categories drop down.protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
populateCategoryField();
}
On the selectedindexchanged event of this drop down, i have created another drop down for "Sub-Categories" dynamically and added it in the place holder.I have assigned the SelectedIndexChanged event for sub categories drop down like this,
DropDownList ddlSubCategory = new DropDownList();
ddlSubCategory.AutoPostBack = true;
ddlSubCategory.SelectedIndexChanged += new EventHandler(this.subCategories_SelectedIndexChanged);
plhCategories.Controls.Add(ddlSubCategory);
and in this method, another sub categories drop down is created.
Now when i change the selection of sub category, it is supposed to create another sub-sub-category drop down but nothing happens.
Plz anyone tell me y isnt it working?
|
|
|
|
|
Dynamically created controls need to be created BEFORE page load, in order that they are in existence when the viewstate is populated ( just before page load ). Otherwise, their state is not restored, nor will their events fire.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
In my website I have used cache. In my load event of the page I check the cache .If it is null I fill a DataTable object from the database and assign that table to the cache. And then in my code I use the cache to fill the controls. Now my problem is this " sometimes I get the "Object reference not set to an instance of an object(NullReferenceException)" error. I am sure that this error is related to cache. Why this error happens sometimes only and not always . what is its cause ? Can someone help me ??
|
|
|
|
|
No one can help you without seeing your code...So if possible please post sample code...
|
|
|
|
|
Things to not stay in the Cache forever. Even if you don't have a timeout set for your cache if the system needs more memory it will expire something in the cache. It is a good coding practice whenever you use something from the cache to first check to make sure it is not null or Nothing in vb.net before you use it. If it is null or Nothing then you need to call the code again to populate the cache.
Hope that helps.
Ben
|
|
|
|