|
Have a look at a response I posted to a similar question
Asp.net MVC VS Asp.Net[^]
In my opinion, MVC is a far better pattern to use for web development - once you get your head around the initial learning curve, it all becomes pretty simple
|
|
|
|
|
Yeah. To bad about legacy apps you cannot have time and resources to port to MVC
No more Mister Nice Guy... >: |
|
|
|
|
|
how to convert the nvarchar datatype to datetime
|
|
|
|
|
|
thank you friend but i want to convert the varchar dataype to datetime format (ie.)if i enter 22.3.2004 in date of birth text box it should to stored on the database as 22/3/2004 how it possible please reply me and also if the user enter like 22.3.2004 error msg has to display pls reply both
|
|
|
|
|
suriyakaqnnan wrote: i want to convert the varchar dataype to datetime format
I replied/shared the exact same question.
suriyakaqnnan wrote: f the user enter like 22.3.2004 error msg has to display
Why? If needed, put your logic on frontend or UI layer. Validate and then pass on to DB.
Try!
|
|
|
|
|
|
use below SQL function to convert DD/MM/YYYY string to Datetime..
Make sure every time u pass "DD/MM/YYYY" format only.
CREATE FUNCTION ChangeDateFormat
(
@STRING NVARCHAR(40),
@DELIMITER NVARCHAR(40)
)
RETURNS DateTime
AS
BEGIN
DECLARE @MM as varchar(5)
DECLARE @DD as varchar(5)
DECLARE @YY as varchar(5)
DECLARE @POS INT
DECLARE @NEXTPOS INT
DECLARE @INT INT
DECLARE @TEMP as varchar(50)
SET @STRING = @STRING + @DELIMITER
SET @POS = charindex(@Delimiter,@String)
SET @INT = 1
WHILE (@POS <> 0)
BEGIN
if @INT = 1
Begin
SET @DD = substring(@String,1,@Pos - 1)
End
if @INT = 2
Begin
SET @MM = substring(@String,1,@Pos - 1)
End
if @INT = 3
Begin
SET @YY = substring(@String,1,@Pos - 1)
End
SET @STRING = substring(@String,@pos+1,len(@String))
SET @POS = charindex(@Delimiter,@String)
SET @INT = @int + 1
END
SET @TEMP = @MM+'/'+ @DD + '/' + @YY
Return convert(datetime, @TEMP)
END
KiranKumar Roy
|
|
|
|
|
You can use Convert.to... in C#
or
CAST('09/25/2004'AS DATETIME)... in SQL Server
|
|
|
|
|
how to check the username and password in login using hasrows in web applications
|
|
|
|
|
suriyakaqnnan wrote: using hasrows
Can you elaborate a little more on it?
suriyakaqnnan wrote: how to check the username and password in login<layer>
For checking username existence, you pass on the username to DB and run a query like:
SELECT COUNT(ID) from MyUserNameTable WHERE UserName = @userName
You check for number of rows returned for the query. If it 'has rows' then it means username already exists.
|
|
|
|
|
Select from database table if the username and password exists. Check for the no of results returned. If is 1 , user is authanticated if 0 , not.
|
|
|
|
|
Is there a cleaner way to pull a lot of data from a form for calculations?
I feel like I have a lotta ugly tryparse stuff going on. Do people just pull it in one go?
I have like 40 controls a user can change (trust me, it can't be helped) and on recalc its a lot of pull, calculate, put back. Seems horribly messy.
|
|
|
|
|
So I guess you don't want to put Javascript in your form to do the calculations ?
I have a fairly complex form with the same problem. I have 2 routines, one to map the screen to internal values and another to map the internal values to the screen. Ugly. Yes; but it works and it is straight forward.
|
|
|
|
|
Not especially no... for one Javascript still isn't as 'native' to me as a language. I imagine I'd have to learn some jquery to handle any of the database pulled information?
using javascript would at least get away from the parsing due to the weak typing though eh?
|
|
|
|
|
I have a huge product editor, with over 80 fields.
I'm on my 8th generation of it now.
The last update I made was to create a huge Javascript object of the entire thing, and small saves just update the object in the DOM, Full saves use $ajax to update the database.
Validation is on the fly using blur
When clicking through the tabs, the data is loaded from the object.
It took me a 2 week to write, over 10K lines of Javascript, but so far so good, no complaints after 3 months of running it.
It's a combination of Javascript and JQuery, but mostly Javascript.
|
|
|
|
|
Hi,
Can u Please take a look at my Question..
Help : Much Needed !![^]
Can u please suggest me a logic which can be used to involve BackGroundWorker Class in ASP.NET App?
A code snippet will be great..
Please it's very urgent.
|
|
|
|
|
sameerbhag wrote: Can u Please take a look at my Question.. Why? You have already received some suggestions there. If you don't understand, then post a reply to the people who responded, and ask for more information.
sameerbhag wrote: it's very urgent. Not to anyone here.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
You would have to write it in javascript, and run it on the client side if you want to see updates, you can try an update panel, but my experience is that it's 1 transmission to the server, and 1 transmission back, and then you have to do it again. I don't use them anymore.
So you would write your balance program in javascript, and create dynamic html via javascript to run in the report window.
Web programs do not run like windows programs, you have to change the way you think in designing your program mechanics. Shifting over to the client side would more closely mimic a windows program.
You can start by optimizing your program to run faster on the server side, get rid of the bloat first. Perhaps ask a small optimization question next.
A Simple Thread Snippet
http://stackoverflow.com/questions/1824933/right-way-to-create-thread-in-asp-net-web-application[^]
|
|
|
|
|
this is the code
static DataLoadOptions objDataLoadOption = GetDataLoadOpt();
public static DataLoadOptions GetDataLoadOpt()
{
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<clsCustomerWithAddresses>(c => c.Addresses);
dlo.LoadWith<clsAddresses>(clsAddresses => clsAddresses.Phone);
return dlo;
}
this workd fine when i try to call it
objContext.LoadOptions = objDataLoadOption;
var MyQuery = from objCustomer in objContext.GetTable<clsCustomerWithAddresses>()
select objCustomer;
I want to change the loadwith option
for this i used reflection to check the forzen variable in dataloadoptions
var freeze = typeof(DataLoadOptions).GetField("frozen", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(objDataLoadOption);
if ((bool)freeze == true)
{
objDataLoadOption = new DataLoadOptions();
objDataLoadOption.LoadWith<clsPhone>(p => p.MobilePhone);
objContext.LoadOptions = objDataLoadOption;
all this works fine. Issue comes after some time. after 2-3 weeks i start getting
LoadWith is not allowed after freeze or attach to DataContext
any idea why i am getting this and how can it be stopped
|
|
|
|
|
You just cannot add load options to already existed context. Add desired options, and then use this context.
No more Mister Nice Guy... >: |
|
|
|
|
|
how can i get the checkbox text from database field name..
for example i have table..
no Fname Mname Lname
1 bilal khatri yousuf
2 faheem chania ali
how can iger the Fname in checkbox1. . . .
|
|
|
|
|
In HTML your output would be like this:
<INPUT TYPE='CHECKBOX' VALUE='1' ID='Name1'><LABEL FOR='Name1'>bilal khatri yousuf</LABEL><br/>
<INPUT TYPE='CHECKBOX' VALUE='2' ID='Name2'><LABEL FOR='Name2'>faheem chania ali</LABEL>
But I am not sure if this is what you want to know.
I wish I could believe there is an after life.
|
|
|
|
|
|
Get the text into a string , split it by space and get the first name.
|
|
|
|