|
actually i have a database table have four fields rnkid, rnkartid,rnkuserid and rnk marks i want sum all the marks which have same rnk art id . pls hel tell how
|
|
|
|
|
You are in wrong forum. This is a simple SQL Query
|
|
|
|
|
Hi,
I am using a regular expression validator to validate my email textbox but I was wondering if there is an expression that allows only a certain domain. This is what I'm using so far:
<asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server" controltovalidate="txtEmail" validationexpression="^\w+[\w-\.]*\@\w+((-\w+)|(\w*))\.[a-z]{2,3}$" errormessage="Please enter an email address in the form xyz@abc.com" xmlns:asp="#unknown"></asp:regularexpressionvalidator>
This works, but it allows any @abc.com and I only want to allow a specific address (i.e. only allow @yahoo.com).I'm using asp.net and c#.
Thanks!
|
|
|
|
|
validationexpression="^\w+[\w-\.]*\@DomainName.com"
i hope this works
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
I'm looking for a datagrid that will allow vertical and horizontal scrolling as well keep the headers for the columns visible at all times.
|
|
|
|
|
Here[^] you can find some articles which will solve the problem.
|
|
|
|
|
Is it worth my while battling with the learning curve of the telerik reporting tool, or battling with trying to add grouping to GridViews? Any other recommendations?
|
|
|
|
|
I would try the Telerik reporting tool. Because if you get stuck, you can post some questions on Telerik's site and they will help you out.
I didn't get any requirements for the signature
|
|
|
|
|
Yeah, I think I'm going with it. I was looking at the Infragistics grid, but it's a bit heavyweight and twice the price. I just wonder how these people can make such awkward designers. People that complain about Microsoft's designers in Visual Studio don't seem to use many other designers.
|
|
|
|
|
I believe using Telerik control will be a better idea as Telerik controls have more features. Based on the documentation and their examples, learning Telerik controls give you much better presentation as well.
Bhaskara
|
|
|
|
|
If you are developing against MS-SQL server, why not consider SQL Server Reporting ? No extra charge if you alreay have MS-SQL server. My 2 cents.
|
|
|
|
|
I need to be able to switch the application between MySQL and MS SQL.
|
|
|
|
|
I'm trying to execute a simple command and pass it to a text box, however it does not seem to work.
Any idea why?
try
{
conAppDB.Open();
string getTaskRef = @"SELECT MAX([taskID_PK]) FROM [teamwiki].[dbo].[task];";
SqlCommand getTaskRefSQL = new SqlCommand(getTaskRef, conAppDB);
if (getTaskRefSQL != null)
{
txtTaskRef.Text = (string)getTaskRefSQL.ExecuteScalar();
}
}
catch (InvalidCastException)
{
}
catch (Exception ex)
{
throw ex;
}
finally {
conAppDB.Close();
}
Environment
.NET framework 2.0.50727 SP1
Visual Studio 2005 Team Edition
Jon
|
|
|
|
|
Have you tried running your sql directly? It may not be returning any data.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Troubleshooting.
I tried using the following line and it returned the expected value on the screen, hence the SQL is working.
Response.Write(getTaskRefSQL.ExecuteScalar());
Jon
|
|
|
|
|
The result of ExecuteScalar can be one of three things.
1. An object of the type you expect. String in this case
2. a DBNull which means that the value of the column you've selected is null
3. a null which means that the query returned no data. (please check for this rather than use an invalid cast exception)
Now, on to what you asked about:
jon_80 wrote: Although the code passes through here, the value of getTaskRefSQL is null, is this a bug?
Are you sue that getTaskRefSQL is null. Unless you've missed something out of your code in the sample above there is no way getTaskRefSQL can be null at the point in the code you've said it is.
|
|
|
|
|
Colin Angus Mackay wrote: jon_80 wrote:
Although the code passes through here, the value of getTaskRefSQL is null, is this a bug?
Are you sue that getTaskRefSQL is null. Unless you've missed something out of your code in the sample above there is no way getTaskRefSQL can be null at the point in the code you've said it is.
That's what I thought; I checked again and now it has a value, however before it was reading null in the watch window
Colin Angus Mackay wrote: The result of ExecuteScalar can be one of three things.
1. An object of the type you expect. String in this case
2. a DBNull which means that the value of the column you've selected is null
3. a null which means that the query returned no data. (please check for this rather than use an invalid cast exception)
Explicit conversion was required because implicit conversion is not allowed by the compiler. I think can check for a DBNull using typeof presumably, however, since a value is being returned I'm not sure why the conversion is not working.
Related links:
http://msdn.microsoft.com/en-us/library/58918ffs(VS.71).aspx[^]
Jon
|
|
|
|
|
jon_80 wrote: Explicit conversion was required because implicit conversion is not allowed by the compiler.
I wasn't talking about that.
jon_80 wrote: I think can check for a DBNull using typeof presumably
Try something like:
object rawValue = theSqlCommand.ExecuteScalar();
if (rawValue == DBNull.Value)
{
}
else
{
string actualValue = (string)rawValue;
}
|
|
|
|
|
|
|
You're right I still haven't planned any error handling as yet
Jon
|
|
|
|
|
Hello All,
I want to delete value from cookie
For Example: The Cookie name [myCooke]
The Cookie Contains--------------------------------------------------------------------------------
myCookeLotID1=7amp;LotNo1=003462&LotName1=Lot 7&BuyPrice1=850&StockQuantity1=56
amp;amp;LotID2=5&LotNo2=003859&LotName2=Lot 3&BuyPrice2=154&StockQuantity2=2
localhost/1536149997862429993731246977484829981862*
---------------------------------------------------------------------------------------------------
The question: How i can delete [LotName2=Lot 3] value from this cookie?
please reply me quickly.
Thank you
Best Regards
Abdullah S. Abdelhay
|
|
|
|
|
I am going to assume that the cookie contents arn't exactly as you typed it...because it seems there are a few typos in it. The following should work:
string cookie = "LotID1=7&LotNo1=003462&LotName1=Lot 7&BuyPrice1=850&StockQuantity1=56&LotID2=5&LotNo2=003859&LotName2=Lot 3&BuyPrice2=154&StockQuantity2=2";
string[] values = cookie.Split('&');
string[] newValues = (from cv in values
let eqIdx = cv.IndexOf('=')
let name = cv.Substring(0, eqIdx)
let value = cv.Substring(eqIdx + 1)
where name != "LotName2"
select cv).ToArray();
string newCookie = String.Join("&", newValues);
|
|
|
|
|
in Fact you cannot delete value from a cookie but
you should have to recreate the cookie with the new value as explained by the previous post.
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
We cannot delete a cookie actually. But one thing we can do is like, we can set the expiry date of the cookie to prior date, so that the browser will remove the cookie when it access the cookie for the next time, since it is expired.
Expiring the Cookie in Server Side:
if (Request.Cookies["MyCookie"] != null)
{
HttpCookie myCookie = new HttpCookie("MyCookie");
myCookie.Expires = DateTime.Now.AddDays(-1d);
Response.Cookies.Add(myCookie);
}
<u>Expiring the Cookie in ClientSide Side:</u>
<script type="text/javascript">
<!--
deleteCookie('MyCookie');
</script>
Please reply on any doubts. Hope this will be usefull for you.
Thanks,
Rajdev KR
|
|
|
|