|
Thanks winnie. i am trying with this but till now not got it working, once it works normaly, then i will try to change it based on my needs.
presently it's throwing lots of error, so i need to correct those errors. hope soon it should work.
People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily
Akhilesh Singh
|
|
|
|
|
Did you get it work ?? i am trying the same thing..
suchita
|
|
|
|
|
hello
java script have the isdate() function ?.
Mohan t working for N.I.C
|
|
|
|
|
there are numerous custom built functions...
i got these from other forums, try it out
*****************************************************
function isDate(dtStr){
var daysInMonth = DaysArray(12)
var pos1=dtStr.indexOf(dtCh)
var pos2=dtStr.indexOf(dtCh,pos1+1)
var strMonth=dtStr.substring(0,pos1)
var strDay=dtStr.substring(pos1+1,pos2)
var strYear=dtStr.substring(pos2+1)
strYr=strYear
if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
for (var i = 1; i <= 3; i++) {
if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
}
month=parseInt(strMonth)
day=parseInt(strDay)
year=parseInt(strYr)
if (pos1==-1 || pos2==-1){
alert("The date format should be : mm/dd/yyyy")
return false
}
if (strMonth.length<1 || month<1 || month>12){
alert("Please enter a valid month")
return false
}
if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
alert("Please enter a valid day")
return false
}
if (strYear.length != 4 || year==0 || year<minyear ||="" year="">maxYear){
alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
return false
}
if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
alert("Please enter a valid date")
return false
}
return true
}
**************************************************
regards
winnie
|
|
|
|
|
thank u.but its a custom function.there is any inbuild function
Mohan t working for N.I.C
|
|
|
|
|
in vbscript the isDate built function is there, but in JS have no idea bout that....
winnie
|
|
|
|
|
yes exactly.u r correct java script doesn't hav that function.thank u
Mohan t working for N.I.C
|
|
|
|
|
|
hi
in javascript.isdate() function
Mohan t working for N.I.C
|
|
|
|
|
How iam using GMDatePicker for entering the
date time .now my problem is
if i selct that as null its sotored in to data base
as 01-01-1900 instead of that ineed to
store
null value how can i do that
Kiran Kumar.P
|
|
|
|
|
I don't think even you assign Null to a DateTime variable since it will elicit a compile time error. Thatz why perhaps, we have a DateTime.MinValue in existence.
|
|
|
|
|
Hai
how can i insert null
if user is not insert any
value that is myquestion
Kiran Kumar.P
|
|
|
|
|
U can't insert NULL For Datetime datatype.
Check out if Date is "01-01-1900" then display "" Instead of "01-01-1900"
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
NULL is not an allowed value for DateTime. Your best bet is the predefined constant DateTime.MinValue .
|
|
|
|
|
hi please help me i have designed a form in asp.net with sqlserver.
<asp:dropdownlist id="ddcountry" style="Z-INDEX: 104; LEFT: 320px; POSITION: absolute; TOP: 232px"
="" runat="server" width="160px">
<asp:listitem>India
<asp:listitem>US
<asp:listitem>UK
<asp:listitem>Canada
SqlConnection con=new SqlConnection("database=anand;server=sdiserver;uid=sa;pwd=sa");
con.Open();
SqlCommand cmd=new SqlCommand("Insert into jai(name,age,gender,conntry)values('"+Txtname.Text+"','"+Txtage.Text+"','"+txtgender.Text+"','"+coun+"'",con);
cmd.ExecuteNonQuery();
con.Close();
i am getting this error
Incorrect syntax near 'India'
please help me
jai prakash
|
|
|
|
|
Missing to enclose query ")" after coun
Best Regard
Pathan
-- modified at 5:30 Friday 24th August, 2007
---------------------------------------------------
|
|
|
|
|
u can take the suggestion given by the previous thread
winnie
|
|
|
|
|
Hai,
Just my small suggestion..This is a regular problem when using the SQl query in this way and is considered a bad programming practice.. You can make it better and free from error by doing it like below.
SqlConenction con = new SqlConnection("database=anand;server=sdiserver;uid=sa;pwd=sa");
con.Open();
SqlCommand cmd = new SqlCommand("insert into jai(name,age,genter,country) values(@name,@age,@genter,@country)",con);
cmd.Parameters.Add("@name",SqlDbType.Char).Value = Txtname.Text;
cmd.Parameters.Add("@age",SqlDbType.Int).Value = int.Parse(Txtage.Text);
cmd.Parameters.Add("@genter",SqlDbType.Char).Value = txtgender.Text
cmd.Parameters.Add("@country",SqlDbType.Char).Value = coun;
cmd.ExecuteNonQuery();
This will help you a lot when doing queries with large number of parameters.
Hope this helps
Laddie
|
|
|
|
|
jai aswitha wrote: SqlCommand cmd=new SqlCommand("Insert into jai(name,age,gender,conntry)values('"+Txtname.Text+"','"+Txtage.Text+"','
"+txtgender.Text+"','"+coun+"'",con);
cmd.ExecuteNonQuery();
If this example is only for some demonstration purpose, then this is ok. You can accept the suggestion given by first poster. But if you are using this in a online server, It looks like you are very closer to SQL Injection Attacks. You should never write queries like this, use parameterized queries or stored procedures. To know regarding the attacks check this[^] excellent article.
|
|
|
|
|
Amongst all syntax and semantic errors that I would like to guide you in this query, the first and foremost to suggest you is that you should take remedial steps to solve the aggressive SQLInjection vulnerability that is blatantly visible in this code snippet.
|
|
|
|
|
Amongst all syntax and semantic errors that I would like to guide you in this query, the first and foremost to suggest you is that you should take remedial steps to solve the aggressive SQLInjection vulnerability that is blatantly visible in this code snippet.
...not to say anything about the sa account name and password.
|
|
|
|
|
Hey peeps.
Ive added a calender to my webparts catalogue, and done some formatting to it in terms of backrground and forecolour etc...
But when i Actually test it and import the calender from the catalogue during run time....it doesnt have the changes....its just its original boring formatting.
Anybody got a clue how and why this thing is messing with me?
thanx
Dazz
|
|
|
|
|
I have a serious problem with updatepanel and checkedchanged event. When the checkbox is in the updatepanel the checkedchanged event never fires when i step through my code, even though auto postback is enabled.
Is there a little trick to this that I'm missing?
|
|
|
|
|
try adding the checkedbox to the trigger collection of the UpdatePanel
|
|
|
|
|
Above step + Make the UpddateMode to Conditional.
|
|
|
|