Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 function REPLACE not recognized by C#.NET

Author  Topic 

sami022
Starting Member

11 Posts

Posted - 2010-02-25 : 12:03:56
INSERT INTO [SAGE] (TIM) SELECT + Replace( LEFT([CHEKTIME] , 10 ), '/', '' ) FROM [CHECKINOUT]

not worcking white Visual Studio 2008 C#.NET

hi every body!

Sachin.Nand

2937 Posts

Posted - 2010-02-25 : 12:07:38
What do u mean in C#.Net?
INSERT INTO [SAGE] (TIM) SELECT Replace( LEFT([CHEKTIME] , 10 ), '/', '' ) FROM [CHECKINOUT]

PBUH
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-02-25 : 12:08:27
Also please post the C# code to.

PBUH
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-25 : 12:09:10
do you mean you're using inline query in .net?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sami022
Starting Member

11 Posts

Posted - 2010-02-25 : 12:19:15
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.IO;

namespace WindowsFormsApplication1
{
public partial class traitement : Form
{
public traitement()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
trait();
}
private void trait()
{
try
{
string connectionString = @"Provider=Microsoft.JET.OLEDB.4.0;data source=E:\projetpfe\Pointage\mdb\att2000.mdb";

using (OleDbConnection conn = new OleDbConnection(connectionString))
{
string sql = "INSERT INTO [SAGE] (TIM) SELECT Replace( LEFT([CHEKTIME] , 10 ), '/', '' ) FROM [CHECKINOUT]";
OleDbCommand cmd = new OleDbCommand(sql, conn);
conn.Open();
OleDbDataReader reader = cmd.ExecuteReader();

MessageBox.Show("Done!");





}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}

hi every body!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-01 : 01:04:06
quote:
Originally posted by sami022

INSERT INTO [SAGE] (TIM) SELECT + Replace( LEFT([CHEKTIME] , 10 ), '/', '' ) FROM [CHECKINOUT]

not worcking white Visual Studio 2008 C#.NET

hi every body!


What did you mean by not working?
Did you get wrong results?
Did you get error?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -