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
Solved

Need help sending from a text box to an SQL Server

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 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