protected void teamGrid_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; string firstName = dataItem["Firstname"].Text; string lastName = dataItem["Lastname"].Text; LinkButton button = dataItem["DeleteColumn"].Controls[0] as LinkButton; button.Attributes["onclick"] = "return confirm('Are you sure you want to deactivate " + firstName + " " + lastName + "?')"; if (dataItem["EndDate"].Text != "") { LinkButton linkButton = (LinkButton)dataItem["EditCommandColumn"].Controls[0]; linkButton.Enabled = false; dataItem["EndDate"].Font.Strikeout = true; } } }I am unable to find the answer to this problem which have been bugging me for a long time.
When I try to insert into sql table, I use this insert method:
Dim datDOB as date
datDOB = RadDatePickerDOB.DbSelectedDate ---- since it is not a required field so it can be nothing
Dim cmdAddNewRecord as new sqlCommand("INSERT INTO [Table1] ([DOB]) " & _
"VALUES ('"& datDOB & "')", SqlConnection)
Dim daAddNewRecord As New SqlDataAdapter(cmdAddNewRecord)
Dim dsAddNewRecord As New DataSet
Try
If SqlConnection.State <> ConnectionState.Open Then
SqlConnection.Open()
End If
daAddNewRecord.Fill(dsAddNewRecord)
lblError.Visible = True
lblError.Text = "Data has been submitted successfully."
Catch ex As Exception
lblError.Text = ex.Message.ToString
Finally
If SqlConnection.State <> ConnectionState.Closed Then
SqlConnection.Close()
End If
End Try
It inserted successfully but it insert this date: 1/1/1900 12:00:00 AM which I do not want! I would like to insert nothing or null into the table.
Anybody has any idea?
Thank you.


