[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Need help sending from a text box to an SQL Server

Posted on 2004-03-23
4
Medium Priority
?
193 Views
Last Modified: 2010-04-15
I have a text box and I need to send the data from it to an SQL Server
the datatype of the field on the server is datetime and a text box is an object... I know how to send it to the database but I don't know how to send it was the correct datatype... that's my error cannot
"Type mismatch"

anyhelp?
0
Comment
Question by:thehick420
2 Comments
 
LVL 12

Accepted Solution

by:
esteban_felipe earned 120 total points
ID: 10658363
Hi thehick420,

SqlConnection sqlConn = new SqlConnection("YOURCONNECTIONSTRING");
SqlCommand sqlCmd = new SqlCommand("Insert into table x (myDataTimeField) values('" + Convert.ToDateTime(Textbox1.Text).ToString() + "')",sqlConn);
sqlConn.open();
sqlCmd.ExecuteNonQuery();

Esteban Felipe
www.estebanf.com
0
 

Author Comment

by:thehick420
ID: 10658460
i'll try that
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question