Click here to Skip to main content
16,005,734 members
Home / Discussions / Database
   

Database

 
GeneralRe: calculations in sql Pin
Minoo S21-Apr-06 8:38
Minoo S21-Apr-06 8:38 
QuestionEasy and fast question Pin
papa198018-Apr-06 3:24
papa198018-Apr-06 3:24 
AnswerRe: Easy and fast question Pin
Colin Angus Mackay18-Apr-06 4:35
Colin Angus Mackay18-Apr-06 4:35 
AnswerRe: Easy and fast question Pin
Paul Conrad18-Apr-06 4:37
professionalPaul Conrad18-Apr-06 4:37 
QuestionSQL Error Number and Description Needed Pin
Brendan Vogt18-Apr-06 3:03
Brendan Vogt18-Apr-06 3:03 
AnswerRe: SQL Error Number and Description Needed Pin
Colin Angus Mackay18-Apr-06 4:42
Colin Angus Mackay18-Apr-06 4:42 
AnswerRe: SQL Error Number and Description Needed Pin
Duncan Edwards Jones18-Apr-06 21:01
professionalDuncan Edwards Jones18-Apr-06 21:01 
QuestionExecuting BCP from C# code Pin
phimix18-Apr-06 2:18
phimix18-Apr-06 2:18 
Aloha to all,

I have thrown together some code that generates a file with a lot of data (something like 200,000 rows). I would like to load all this data in a SQL Server table, but my attempt to execute BCP from C# doesn't want to behave.

I do as follows (more of less stealing everything from http://dotnetjunkies.com/WebLog/stefandemetz/archive/2004/08/19/22566.aspx Poke tongue | ;-P ):
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo = new System.Diagnostics.ProcessStartInfo();
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.FileName = "bcp";
proc.StartInfo.Arguments = @"DATABASE_NAME.dbo.TABLE_NAME in c:\inetpub\wwwroot\project\bcpData.txt -c -Uusername -Ppassword -t',' -Sservername";
proc.EnableRaisingEvents = true;
proc.Start();
string s1 = proc.StandardOutput.ReadLine();
string s2 = proc.StandardOutput.ReadLine();

All I get from this code is:
s1 = "SQLState = 28000, NativeError = 18456";
s2 = "Error = [Microsoft][SQL Native Client][SQL Server]Login failed for user 'username'."

I have off course checked the username/password a thousand times and it is correct. If I copy my Arguments string to the command prompt, I can execute BCP without any problem OMG | :OMG:

Thank you and roger over, Mads

phi
phimix.com OMG | :OMG:
AnswerRe: Executing BCP from C# code Pin
phimix19-Apr-06 1:03
phimix19-Apr-06 1:03 
QuestionSql Server Pin
Krishnatv18-Apr-06 0:53
Krishnatv18-Apr-06 0:53 
AnswerRe: Sql Server Pin
Colin Angus Mackay18-Apr-06 1:48
Colin Angus Mackay18-Apr-06 1:48 
GeneralThank u Pin
Krishnatv18-Apr-06 2:30
Krishnatv18-Apr-06 2:30 
QuestionProblem Printing Labels using SQL 2000 Reporting Services Pin
slave11e18-Apr-06 0:15
slave11e18-Apr-06 0:15 
AnswerRe: Problem Printing Labels using SQL 2000 Reporting Services Pin
Darpan Gogia18-Apr-06 23:18
Darpan Gogia18-Apr-06 23:18 
Questionsql table index (SQL2005) Pin
Sk8tzz17-Apr-06 23:43
Sk8tzz17-Apr-06 23:43 
AnswerRe: sql table index (SQL2005) Pin
Colin Angus Mackay17-Apr-06 23:59
Colin Angus Mackay17-Apr-06 23:59 
GeneralRe: sql table index (SQL2005) Pin
Sk8tzz18-Apr-06 0:03
Sk8tzz18-Apr-06 0:03 
AnswerRe: sql table index (SQL2005) Pin
Eric Dahlvang19-Apr-06 3:59
Eric Dahlvang19-Apr-06 3:59 
AnswerRe: sql table index (SQL2005) Pin
Eric Dahlvang19-Apr-06 4:01
Eric Dahlvang19-Apr-06 4:01 
GeneralRe: sql table index (SQL2005) Pin
Sk8tzz19-Apr-06 18:59
Sk8tzz19-Apr-06 18:59 
Questionintegrating 2 sql results Pin
dansoft17-Apr-06 18:21
dansoft17-Apr-06 18:21 
AnswerRe: integrating 2 sql results Pin
Colin Angus Mackay17-Apr-06 20:50
Colin Angus Mackay17-Apr-06 20:50 
GeneralRe: integrating 2 sql results Pin
dansoft18-Apr-06 4:30
dansoft18-Apr-06 4:30 
GeneralRe: integrating 2 sql results Pin
Darpan Gogia18-Apr-06 23:24
Darpan Gogia18-Apr-06 23:24 
GeneralRe: integrating 2 sql results Pin
dansoft19-Apr-06 2:40
dansoft19-Apr-06 2:40 

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.