|
The 102 datetime format gives u this format yyyy.MM.dd
Try to run that code on Query Analyzer and see if it is according to your need, if not then fell free to ask
I Love T-SQL
|
|
|
|
|
Hi,
Ive tried running it and im getting absolutely nothing back. Ive updated the SQL as such for my table/data:
declare @date as varchar(15)
set @date = '2008-04-16'
select * from tbl_QualityStandard where qs_Start >= convert(varchar(15),cast(@date as datetime),102)
and qs_Start <= convert(varchar(15),(cast(@date as datetime)-365*2),102)
|
|
|
|
|
do u have recoreded data in qs_Start column:
qs_Start<br />
2008-04-16<br />
2008-04-15<br />
2008-04-14<br />
2008-04-13
or
qs_Start<br />
2008.04.16<br />
2008.04.15<br />
2008.04.14<br />
2008.04.13
or write me how u have inserted data in qs_start column
I Love T-SQL
|
|
|
|
|
Hi,
My date format is:
15/04/2008 eg day/month/year
|
|
|
|
|
try this
declare @date as varchar(15)<br />
set @date = '2008-04-16'<br />
select * from tbl_QualityStandard where qs_Start >= convert(varchar(15),cast(@date as datetime),103)<br />
and qs_Start <= convert(varchar(15),(cast(@date as datetime)-365*2),103)
I Love T-SQL
|
|
|
|
|
I do transaction in the business layer, and I use EntLib's DAAB.
This gives me some problems, namely a InvalidOperationException: "ExecuteNonQuery requires an open and available Connection. The connection's current state is closed."
I've tried both using the TransactionScope, and the ServiceConfig way of doing COM+ transactions.
It works fine without the transaction stuff.
I'm well aware that the connection gets closed since I do transaction from the business layer, but that should be possible, even if it then becomes a distributed transaction.
As I mentioned I'm also using the Enterprise Library Data Access Application Block, and Im'm wondering if that's what screwing things up.
Any good advice?
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
I solved it! After a days worth of hair-pulling
Apparently, DAAB v 3.1 closes the connection so you don't have to, and when I did so explicitly it got messed up.
I guess it's just a good case of "you create it - you close it".
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
I have dynamic links in a GridView. When the LinkButton Text has certain value e.g. "None", I want to disable them. Initial display is right - as Im using this code in the Page_Load:
for (int i = 0; i < gvStatus.Rows.Count; i++)<br />
{<br />
lb = (LinkButton)gvStatus.Rows[i].FindControl("lnkAction");<br />
if (lb.Text == "None")<br />
{<br />
lb.Enabled = false;<br />
}<br />
}<br />
When the GridView PageIndex changes though, the links show up as Enabled, So I put the same code in the Page_Load's if(Page.IsPostBack) and also GridView's OnPageIndexChanged event handler, still does the same.
I believe, part of the problem is, I am using AJAX UpdatePanel.
Any ideas?
Thanks
|
|
|
|
|
I got it done by using the code in the RowDataBound event handler.
Thanks.
Ekjon
|
|
|
|
|
It is the only place to do such actions.
|
|
|
|
|
Hello All,
A confusing issue (for me anyway) came up while trying to utilize a GridView on a page. I have a drop down list that contains a value that is used to perform a stored procedure via my SQL DataSource and then bind the results to my GridView. Slick as can be with hardly no coding as you all know.
Here is the issue though, I am trying to display a count of the results on the same page but for some reason, I get the previous page count. For example, on the first page load there are 5 results, the label displays 5. If I select another option from the dropdown and I know there will be no results, the label still displays 5, but if I select another option where there are results, the label displays 0. How is it that I am getting the previous count and not the current count?
So, my question is, how do I get the current count on each submission? Thank you in advance for any offers of help.
|
|
|
|
|
You can use ViewState to store the count. To display it on the label, get the value from the ViewState - If I understood the problem right.
|
|
|
|
|
What code have you written in the selectedIndexChanged Event from the gridview?
|
|
|
|
|
I haven't put any code in the SelectedChangeIndex Event. I only have this:
this.Label3.Text = this.GridView1.Rows.Count.ToString();
in the Page_Load event.
And as far as the ViewState recommendation, I don't see where I can apply that to the GridView. I am wondering if I can't get an accurate count because I am not using a datatable(?). I am just using the stored procedure call in the SQLDataSource component to bind directly to the GridView. Could this be the reason.
|
|
|
|
|
In your aspx you can say:
AllowPaging="true" OnPageIndexChanging="GridView1_OPIC"
in your codebehind it would be something like:
protected void GridView1_OPIC(Object sender, GridViewPageEventArgs e)
{
this.Label3.Text = this.GridView1.Rows.Count.ToString();
}
|
|
|
|
|
This is a great start! I tried this but I don't think I hit the code when the paging limit is not reached. I therefore am trying to run the same at the GridView DataBinding event, although I cannot find the actual EventArgs for this particular event. But I'll keep digging.
Thank you everyone for you help.
|
|
|
|
|
Somewhere in your code you state GridView1.DataBind();
when that is done you should be able to fill your label with the appropriat value.
You should aslo be able to acces GridView1.FooterRow object. Maybe that could help you in the right direction.
|
|
|
|
|
Hi,
I would like to find a specific location in an xml file and change the value dynamically using an input value from a user.
My file looks something like this:
<sub1>
some text 1
<sub2>
some text 2
e.g I would like to go to some text 1 and replace it with a textbox value.
I need a method which goes into a .aspx.vb file without using XSLT.
Cam anyone please help me?
Thank u in advance
|
|
|
|
|
Dot Net rookie wrote: My file looks something like this:
It appears you wanted us to see your XML file, yes? Look at your post, we can't see the XML. You have to read and follow the posting instructions for the site to get XML to be visible.
To work with XML the way you describe you want to use the XML DOM (Document Object Model). Classes are located in the System.Xml namespace. Two good web resources with tutorials working with XML is TopXml and www.w3schools.com
led mike
|
|
|
|
|
Hi,
assuming the XML file is in a correct format and that some text are elements just under the root node, you could use XMLDocument to get to the desired node, then change the value and save the file again. Something like...
Private Sub ChangeXMLValue(ByVal XMLPath As String, ByVal NewValue As String)<br />
' Load XML<br />
Dim xmlDoc As New Xml.XmlDocument<br />
xmlDoc.Load(XMLPath)<br />
<br />
' Find node<br />
Dim xmlNodes As Xml.XmlNodeList = xmlDoc.GetElementsByTagName("[Name Of the Tag which contains 'some text 1']")<br />
If xmlNodes.Count > 0 Then ' Found it<br />
' Replace value <br />
xmlNodes(0).Value = NewValue<br />
End If<br />
<br />
' Replace XML <br />
System.IO.File.Delete(XMLPath)<br />
xmlDoc.Save(XMLPath)<br />
End Sub
Something like that. Not tested but hope it helps.
|
|
|
|
|
Thank you very much it works great.
|
|
|
|
|
I have a project compiled in Framework 3.5[VS 2008]. I cannot deploy it on another server which supports only Framework 3.0.
How do I convert my existing application in 3.5 to 3.0? I have not used any specific feature which belongs to 3.5 only.
Please help
Thanks
|
|
|
|
|
If your using VWD you need
Click Website, Start Options, click the Build node, change Target Framework to the one you want, click OK. You should rebuild the project, then close it out in VWD2008 before reopening in 2005.
|
|
|
|
|
there is a field that its type is datetime in sqlserver. now i want insert a record with c# and i dont know how its format. can any body help me? i want thats code
|
|
|
|
|
Can you explain your problem a bit more, are you having trouble with some code, can we see that code?
|
|
|
|