Click here to Skip to main content
15,919,178 members
Home / Discussions / Database
   

Database

 
AnswerRe: SQL Server Express and Visual C# Pin
Henry Minute29-Jun-09 6:43
Henry Minute29-Jun-09 6:43 
QuestionRe: SQL Server Express and Visual C# Pin
kikeman30-Jun-09 7:40
kikeman30-Jun-09 7:40 
AnswerRe: SQL Server Express and Visual C# Pin
Henry Minute30-Jun-09 9:24
Henry Minute30-Jun-09 9:24 
AnswerRe: SQL Server Express and Visual C# Pin
Niladri_Biswas28-Jun-09 16:53
Niladri_Biswas28-Jun-09 16:53 
QuestionConversion failed when converting datetime from character string Pin
piticcotoc27-Jun-09 21:13
piticcotoc27-Jun-09 21:13 
AnswerRe: Conversion failed when converting datetime from character string [modified] Pin
Niladri_Biswas27-Jun-09 21:32
Niladri_Biswas27-Jun-09 21:32 
GeneralRe: Conversion failed when converting datetime from character string Pin
piticcotoc27-Jun-09 21:39
piticcotoc27-Jun-09 21:39 
GeneralRe: Conversion failed when converting datetime from character string Pin
Niladri_Biswas27-Jun-09 21:59
Niladri_Biswas27-Jun-09 21:59 
Hi, I have created a similar kind of thing like yours.

A table with 3 fileds (COL1,COL2,Date) as

(VARCHAR(50),VARCHAR(50),DATETIME respectively)

In C# class, I have written this statement

public class DBConnectionSQL
    {
        string connectionPath = "Data Source=Niladri135\\SQLEXPRESS;Initial Catalog=test;Integrated Security=True";
        string command = "";

            
        public void InsertRecords()
        {

            SqlConnection connection = new SqlConnection(@connectionPath);
            DateTime currentValue  = System.DateTime.Now;
            command = "Insert Into test_Datetime (COL1, COL2,DATE) values('value 1', 'value 2'," + "'" +  currentValue + "'" +  ")";
            try
            {
                connection.Open();
                SqlCommand cmd = new SqlCommand(command, connection);
                cmd.ExecuteNonQuery();
            }
            catch (SqlException sqlExcep)
            {
                string msg = sqlExcep.Message;
            }
            finally
            {
                connection.Close();
            }
        }
    }



And I got the correct result.

N.B.~ Check the value in the insert string in your case. Is the datetime value within single quote e.g.'6/28/2009 1:20:55 PM' ?

Hope this helps
Smile | :)

Niladri Biswas

GeneralRe: Conversion failed when converting datetime from character string Pin
piticcotoc28-Jun-09 0:27
piticcotoc28-Jun-09 0:27 
GeneralRe: Conversion failed when converting datetime from character string Pin
piticcotoc28-Jun-09 0:31
piticcotoc28-Jun-09 0:31 
GeneralRe: Conversion failed when converting datetime from character string [modified] Pin
Niladri_Biswas28-Jun-09 16:00
Niladri_Biswas28-Jun-09 16:00 
GeneralRe: Conversion failed when converting datetime from character string Pin
Luc Pattyn28-Jun-09 16:14
sitebuilderLuc Pattyn28-Jun-09 16:14 
GeneralRe: Conversion failed when converting datetime from character string Pin
Niladri_Biswas28-Jun-09 16:55
Niladri_Biswas28-Jun-09 16:55 
GeneralRe: Conversion failed when converting datetime from character string Pin
piticcotoc28-Jun-09 19:33
piticcotoc28-Jun-09 19:33 
QuestionConnecting to SQL 2000 Server from the Internet using public IP Address Pin
Thayhor27-Jun-09 15:22
Thayhor27-Jun-09 15:22 
AnswerRe: Connecting to SQL 2000 Server from the Internet using public IP Address Pin
Niladri_Biswas27-Jun-09 16:24
Niladri_Biswas27-Jun-09 16:24 
GeneralRe: Connecting to SQL 2000 Server from the Internet using public IP Address Pin
Thayhor27-Jun-09 20:41
Thayhor27-Jun-09 20:41 
GeneralRe: Connecting to SQL 2000 Server from the Internet using public IP Address [modified] Pin
Thayhor27-Jun-09 20:58
Thayhor27-Jun-09 20:58 
GeneralRe: Connecting to SQL 2000 Server from the Internet using public IP Address Pin
Jerry Hammond28-Jun-09 17:15
Jerry Hammond28-Jun-09 17:15 
GeneralRe: Connecting to SQL 2000 Server from the Internet using public IP Address Pin
Niladri_Biswas28-Jun-09 17:39
Niladri_Biswas28-Jun-09 17:39 
GeneralRe: Connecting to SQL 2000 Server from the Internet using public IP Address Pin
Sujay chakraborty28-Jun-09 16:36
Sujay chakraborty28-Jun-09 16:36 
GeneralRe: Connecting to SQL 2000 Server from the Internet using public IP Address Pin
Niladri_Biswas28-Jun-09 17:47
Niladri_Biswas28-Jun-09 17:47 
GeneralRe: Connecting to SQL 2000 Server from the Internet using public IP Address Pin
Sujay chakraborty28-Jun-09 18:16
Sujay chakraborty28-Jun-09 18:16 
QuestionSQL Issue during database creation Pin
Bahram.Zarrin27-Jun-09 5:42
Bahram.Zarrin27-Jun-09 5:42 
AnswerRe: SQL Issue during database creation Pin
Luc Pattyn27-Jun-09 6:09
sitebuilderLuc Pattyn27-Jun-09 6:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.