Solved

Need help sending from a text box to an SQL Server

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now