TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ekrem Tapan
NA
967
81.7k
Insert dateTime Problem
Oct 6 2015 2:43 AM
hi everybody,
i want to insert mysql datetime, sometimes i will input but sometimes i dont wanna input any date
below is my code
but not working
Dim sqldatenull As SqlDateTime
Using Cmd As New MySqlCommand
Cmd.CommandText = "INSERT INTO Data (SBID ,SiteID ,MainSID ,AreaID ,ContentType ,Title ,URL ,Targets ,Files ,ViewCount ,Filess ,Contents ,DisplaySDate ,DisplayEDate) VALUES (?SBID ,?SiteID ,?MainSID ,?AreaID ,?ContentType ,?Title ,?URL ,?Targets ,?Files ,?ViewCount,?Filess ,?Contents ,DisplaySDate ,DisplayEDate)"
Cmd.Parameters.Add(New MySqlParameter("?SBID", SBID))
Cmd.Parameters.Add(New MySqlParameter("?SiteID", SiteID))
Cmd.Parameters.Add(New MySqlParameter("?MainSID", MainSID))
Cmd.Parameters.Add(New MySqlParameter("?AreaID", AreaID))
Cmd.Parameters.Add(New MySqlParameter("?ContentType", ContentType))
Cmd.Parameters.Add(New MySqlParameter("?Title", Title))
Cmd.Parameters.Add(New MySqlParameter("?URL", URL))
Cmd.Parameters.Add(New MySqlParameter("?Targets", Targets))
Cmd.Parameters.Add(New MySqlParameter("?Files", Files))
Cmd.Parameters.Add(New MySqlParameter("?Filess", Filess))
Cmd.Parameters.Add(New MySqlParameter("?Contents", Contents))
Cmd.Parameters.Add(New MySqlParameter("?ViewCount", ViewCount))
sqldatenull = SqlDateTime.Null
If (DisplaySDate.ToString() = "") Then
Cmd.Parameters.Add(New MySqlParameter("?DisplaySDate", DisplaySDate)).Value = sqldatenull
Else
Cmd.Parameters.Add(New MySqlParameter("?DisplaySDate", DisplaySDate))
End If
If (DisplayEDate.ToString() = "") Then
Cmd.Parameters.Add(New MySqlParameter("?DisplayEDate", DisplayEDate)).Value = sqldatenull
Else
Cmd.Parameters.Add(New MySqlParameter("?DisplayEDate", DisplayEDate))
End If
i have a this error
http://oi60.tinypic.com/ops1d.jpg
this is a inputbox get set code
Public Property DisplaySDate() As DateTime
Get
DisplaySDate = Me.txtDisplaySDate.Text
End Get
Set(value As DateTime)
Me.txtDisplaySDate.Text = value
End Set
End Property
Public Property DisplayEDate() As DateTime
Get
DisplayEDate = Me.txtDisplayEDate.Text
End Get
Set(value As DateTime)
Me.txtDisplayEDate.Text = value
End Set
End Property
Reply
Answers (
5
)
My website working on iis but not working on cpanel
filling a textbox when dropdown selected item change