Click here to Skip to main content
15,889,822 members
Home / Discussions / C#
   

C#

 
AnswerRe: Format of the initialization string does not conform to specification starting at index 0.???? Pin
Wendelius4-Sep-08 9:16
mentorWendelius4-Sep-08 9:16 
GeneralRe: Format of the initialization string does not conform to specification starting at index 0.???? Pin
Twyce4-Sep-08 9:35
Twyce4-Sep-08 9:35 
GeneralRe: Format of the initialization string does not conform to specification starting at index 0.???? Pin
Twyce4-Sep-08 9:42
Twyce4-Sep-08 9:42 
AnswerRe: Format of the initialization string does not conform to specification starting at index 0.???? Pin
Pete O'Hanlon4-Sep-08 9:46
mvePete O'Hanlon4-Sep-08 9:46 
GeneralRe: Format of the initialization string does not conform to specification starting at index 0.???? Pin
Twyce4-Sep-08 9:50
Twyce4-Sep-08 9:50 
GeneralRe: Format of the initialization string does not conform to specification starting at index 0.???? Pin
Pete O'Hanlon4-Sep-08 9:55
mvePete O'Hanlon4-Sep-08 9:55 
GeneralRe: Format of the initialization string does not conform to specification starting at index 0.???? Pin
Twyce4-Sep-08 10:51
Twyce4-Sep-08 10:51 
GeneralRe: Format of the initialization string does not conform to specification starting at index 0.???? Pin
Pete O'Hanlon4-Sep-08 11:01
mvePete O'Hanlon4-Sep-08 11:01 
The following is your code:
public class CopyData
{
string _sourceConnectionString = "Data Source= sict-sql;Initial Catalog=PSAtechZ;Integrated Security=True;";
string _destinationConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "E:\\+PSATECHZ EYES ONLY+\\PSAtechZTimetableSystem\\Students.xls" + "; Extended Properties='Excel 12.0; IMEX=1; HDR=YES'";

public CopyData(string sourceConnectionString, string destinationConnectionString)
{
_sourceConnectionString = sourceConnectionString;
_destinationConnectionString = destinationConnectionString;
}

public void CopyTable(string StudentModule)
{
using (SqlConnection source = new SqlConnection(_sourceConnectionString))
{
string sql = string.Format("SELECT * FROM [{0}]", StudentModule);

SqlCommand command = new SqlCommand(sql, source);

source.Open();
SqlDataReader dr = command.ExecuteReader();
//IDataReader dr = command.ExecuteReader();

using (SqlBulkCopy copy = new SqlBulkCopy(_destinationConnectionString))
{
copy.DestinationTableName = StudentModule;
copy.WriteToServer(dr);
}
}
}
}
I've highlighted the line that changes the value. The code that creates this class is presumably doing something along the lines of CopyData c = new CopyData("connectionString", "destConnectionString");. Step into the CopyTable method and see what the value of _sourceConnectionString is before you execute the line
using (SqlConnection source = new SqlConnection(_sourceConnectionString))


Deja View - the feeling that you've seen this post before.

My blog | My articles



GeneralRe: Format of the initialization string does not conform to specification starting at index 0.???? Pin
Twyce4-Sep-08 11:42
Twyce4-Sep-08 11:42 
GeneralRe: Format of the initialization string does not conform to specification starting at index 0.???? Pin
Wendelius6-Sep-08 9:18
mentorWendelius6-Sep-08 9:18 
Questionusing Task Scheduler 2.0 with XP Home Edition no password Pin
Member 23173964-Sep-08 7:42
Member 23173964-Sep-08 7:42 
Question[Solved]Have two forms open at the same time Pin
Jordanwb4-Sep-08 7:14
Jordanwb4-Sep-08 7:14 
AnswerRe: Have two forms open at the same time Pin
Aslesh4-Sep-08 7:39
Aslesh4-Sep-08 7:39 
GeneralRe: Have two forms open at the same time Pin
Jordanwb4-Sep-08 12:02
Jordanwb4-Sep-08 12:02 
AnswerRe: [Solved]Have two forms open at the same time Pin
nelsonpaixao4-Sep-08 13:43
nelsonpaixao4-Sep-08 13:43 
QuestionFile Listener instead BizTalk Orchestration Pin
Member 22295194-Sep-08 7:06
Member 22295194-Sep-08 7:06 
AnswerRe: File Listener instead BizTalk Orchestration Pin
WillemM4-Sep-08 7:45
WillemM4-Sep-08 7:45 
GeneralRe: File Listener instead BizTalk Orchestration Pin
Member 22295195-Sep-08 12:53
Member 22295195-Sep-08 12:53 
GeneralRe: File Listener instead BizTalk Orchestration Pin
WillemM5-Sep-08 20:05
WillemM5-Sep-08 20:05 
QuestionRe: File Listener instead BizTalk Orchestration Pin
Member 22295195-Sep-08 22:33
Member 22295195-Sep-08 22:33 
AnswerRe: File Listener instead BizTalk Orchestration Pin
WillemM5-Sep-08 22:34
WillemM5-Sep-08 22:34 
QuestionReg Ex Pin
Aslesh4-Sep-08 6:07
Aslesh4-Sep-08 6:07 
AnswerRe: Reg Ex Pin
PIEBALDconsult4-Sep-08 6:35
mvePIEBALDconsult4-Sep-08 6:35 
GeneralRe: Reg Ex Pin
Aslesh4-Sep-08 6:38
Aslesh4-Sep-08 6:38 
GeneralRe: Reg Ex Pin
Guffa4-Sep-08 6:47
Guffa4-Sep-08 6:47 

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.