Solved

Need help sending from a text box to an SQL Server

Posted on 2004-03-23
4
188 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 30 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

695 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