?
Solved

Need help sending from a text box to an SQL Server

Posted on 2004-03-23
4
Medium Priority
?
192 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 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

Technology Partners: 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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

649 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