Hello,
I replaced the calendar control to 3 dropdownlists(day,month and year) coz
i want to display the calendar as just like DTPicker in vb.6. But i cant able
to display like that. The form ocupies more space. But i am facing another
problem.
My table structure is staff(empid integer,joindate datetime)
i am getting the date selected as
dim doj as new datetime(yr.selectedValue,mnth.selectedvalue,dy.selectedvalue)
qry="insert into staff(empid,joindate) values(@empid,@joindate)"
dim idparam as new sqlparameter("@empid",sqlDBType.integer)
dim dtparam as new sqlparameter("@joindate",sqlDBType.datetime)
idparam.value=txtID.text
dtparam.value=doj.toShotdatestring()
conn.open()
dbcommand=new sqlcommand(qry,conn)
dbcommand.parameters.add(idparam)
dbcommand.parameters.add(dtparam)
dbcommand.executenonquery()
conn.close()
'i am getting the error "input string is not in correct format. only the
problem is with date. When using calendar, executed well. I hope some cating
problem but i couldn't resolve?
thanks for the reply
Greg Young - 01 May 2006 08:34 GMT
Don't see why you are doing the ToString(), it will only put it back to a
datetime internally .. try this.
dtparam.value=doj
Cheers,
Greg
> Hello,
>
[quoted text clipped - 31 lines]
>
> thanks for the reply
Rajani - 01 May 2006 10:37 GMT
Hello,
I tried as u said. Still the same problem "Input string is not correct
format"
what could be the problem?
> Don't see why you are doing the ToString(), it will only put it back to a
> datetime internally .. try this.
[quoted text clipped - 39 lines]
> >
> > thanks for the reply
Chris Chilvers - 01 May 2006 17:07 GMT
What about this line:
idparam.value=txtID.text
Have you tried using:
idparam.value = Int32.Parse(txtID.text)
>Hello,
>
[quoted text clipped - 46 lines]
>> >
>> > thanks for the reply