I have a web app with a form that I am trying to pass to an ASP.NET server (using VB.NET) and then on to a MS SQL Server table. The form uses a jQuery datepicker in several textboxes and formats them as MM/dd/yyyy. The form fields are then passed through a PageMethod to the web server which takes the various field values and combines them into a SQL UPDATE command.
I am constantly getting the following error whenever I try to execute the SQL command:Conversion failed when converting date and/or time from character string.Here is the code on the server:
Using myConn As New System.Data.SqlClient.SqlConnection(CString.ConnectionString)
myConn.Open()
Dim cmd As New System.Data.SqlClient.SqlCommand("UPDATE table " & _
[code]....
Note: I've tried about twenty different ways of parsing the dates, converting them to dates, changing around the formats and none of it has worked.
Note 2: The conditional statements at the end are simply to prevent empty date fields from being stored in the SQL DB as "1/1/1900", but rather as an actual SQL NULL value. From debugging though, it seems that this is not the issue - it is when there is an actual value that the error is fired.
Dim myRequest As System.Net.WebRequest = System.Net.WebRequest.Create(url) Dim myResponse As System.Net.WebResponse = myRequest.GetResponse() Dim rssStream As System.IO.Stream = myResponse.GetResponseStream() Dim rssDoc As New System.Xml.XmlDocument() Try rssDoc.Load(rssStream)
[Code]...
Folks this is what I'm using to parse an RSS feed for the last updated time. Is there a quicker way? Speed seems to be a bit slow on it as it pulls down the entire feed before parsing.
Is there a way to do so? Say sometimes I see March 2nd, 1921
Latter I see 2 March 2010.Is there a function GetDate(SomeString as string) as Date?That will sort of recoqnize all those different format and "try" parsing.
I've been running into some errors with converting strings to dates in the following code. I have recently added the intcall.Value = DateTime.Parse(txtIntCallDate.Text) function which had gotten rid of the error message, however the records are not being updated, any of them on the form. Prior to this the strings were being updated just fine. As long as there is a date entered on the form there is no error, if it's left blank i get the "Problem converting string to datetime"
I would like to be able to parse vb.net code files, so I can examine the collection of Subs, Functions (and their contents, including comments), private variables, etc. I can be open the actual source code files. So for example, if I have:
I'm creating a vb.net winforms application that will take in user given strings, parse them, and print out labels with variable information. The given string will be used in all the labels, but the variable part of the string will change with each label.
My question is: is it better to parse the strings one time, then store those values in arrays, or to parse the string each time a label is printed? Which will perform better? Which is better practice? What is the proper way to test something like this?
I have been disturbed for a week now. I have a project in vb.net. And on forms I have two masked text boxes. One is for the user to enter their date of birth and in the second one Iam trying to get the date the record is created. With this one I get the current date from pc and format it to dd/mm/yyyy because I want the user to understand the date. How do I INSERT the user date of birth and the the Now () date which is also in masked text box into a MYSQL database? I know how to insert other text but the date fails to appear in database.
I have some date fields that I want to not have any dates during a record creation. I figured the way to go would be to insert NULL. The way I'm going about it now gives me a Type mismatch error.[code]...
I am using VB 2008 and have a datetime picker. I wam trying to use this value in an INSERT command to load in to a table but I just can't get it to work. I debug it out which shows something along the lines of "24/03/2010" but it just won't accept it. However, if I create a string variable e.g. strDate = "24/03/2010". it works. I am obviously doing something wrong in the conversion.
i get the date value from other field then need to insert it into other database. but the problem is when the column is null the n it cannot insert it.
I Want To Insert Date Into Sql 2005 But Without Using Datetimepicker In Vb Net 2005 forms every time i do it by using textbox got an erro converting iwant to use textbox like we use it in access with input mask is that avilable
i have a maskedtextbox which will accept only date in the format of "DD-MM-yyyy" no i want to insert this date in my db. i have done this successfully.
Now i want to insert null value in through that maskedtextbox .
I have a button coded on my screen that copies pre-typed text to the clipboard so all I have to do is paste the info where I need it to go.Problem is that in my original pretyped text in Word I have the text setup to always insert the current date in on my page. How can I format my code here to insert the current date in the string?
Private Sub CommandButton9_Click() Dim MyText As DataObject, TextStr As String Set MyText = New DataObject
I'm using ASP.NET/VB and I'm trying to insert a date and time into an Access date/time field, but I'm getting an error (Data type mismatch in criteria expression). Here's a simplified version of my code:
Dim myDate As Date = Now() Dim myIns1 As New OleDbCommand("INSERT INTO tableCourse (date_submitted) VALUES (?)", myConn) myIns1.Parameters.AddWithValue("@myDate", myDate) myIns1.ExecuteNonQuery()
Not sure why I'm getting the error, and not quite sure if this is even the correct way to approach inserting the current date. From looking at other similar questions it appears there are a few different ways to do this, but my technical knowledge is kind of limited so I'm having a hard time figuring it out (in other words deciphering the answers that use technical terms I know nothing about).
I'm trying to get a small webpage to update an access database. There are no problems with the data the user enter but when I try to update the database with current date and time it fails.I'm using a FormView to enter data.
If Not IsPostBack Then '==========>Update db with currenttime
I have written some code that generates an output file from an external executable. I would like to insert the current date and time into the resulting filename. In the pi.Arguments line (shown below) the /l= creates the output file. I would like the name of the file to be Trustee_Restore_YYYYMMDD_HHMMSS.TXT.
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Dim p As New Process Dim pi As New ProcessStartInfo
[code]....
Everything works, except I would like to insert the date into the output filename.