1
Answer

while processing file from source to destination using prss?

sanath avua

sanath avua

7y
207
1

while processing file from source path to destination path using process.StartInfo ,getting an error file not found.

I have pasted source code in below.plesase look the commented lines as well.

could you please help to resolve the error.

public string submitFile(string SourceFilePath, string CWID, string SystemName, string destFileName, string fileType)
{
string strresult = "";
try
{
string strDestPath = _configurationManager.AppSettings["Attachmentpath"];
if (SystemName.Trim() == "xvalue")
{
string BatfilePath = _configurationManager.AppSettings["BatFilePath"];

if (File.Exists(SourceFilePath))
{
destFileName = destFileName.Replace("\"", "");
string DestinationFilePath = "\"" + strDestPath + "\\" + CWID + "_" + destFileName + "." + fileType + "\"";
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = BatfilePath + "Unzip.bat";
process.StartInfo.UseShellExecute = false;
//here maping sourec and destination paths like below :-
//SourceFilePath = D:\Data\CWAttachment\test.txt
//DestinationFilePath; D:\RetValue\CWAttachment\cW123_test.txt
process.StartInfo.Arguments = SourceFilePath + "\t" + DestinationFilePath;

process.Start();//this place i am getting an error
process.WaitForExit();
strresult = "Processed";
}
else
{
strresult = "FileNotFound";
}
}
}
catch (Exception ex)
{
//Log.Error("Error occured while submitFile an CWAttachmentInfo ", ex);
}
return strresult;
}
Answers (1)
0
Ankur Gupta

Ankur Gupta

NA 2k 982k 14y


Correct sSql string is follows..
sSQL = "Insert into Transaction_Line (TransL_id,Trans_id, TL_dt, Pro_id, Quantity)" & _
"values('" & TransLid & "', '" & transID & "', '" & TLdte & "', '" & proID & "', '" & quan & "')"

Change transID Position in values it will be in 2nd position.
 
0
Crish

Crish

NA 3.7k 76.4k 14y
hi

i think you have taken date field value int not datetime or varchar . That's why you are getting this error.

please change it to datetime.

Don't forget to Mark Do you like this Answer  that solved your problem!
0
Ayesha balooshi

Ayesha balooshi

NA 18 22.7k 14y


TransL_id: Varchar(25)
Trans_id: int
Pro_id: Varchar(15)
Quantity: numeric(4, 0)
Total_price: numeric(10, 2)
TL_dt: varchar(50)
Share_h_id: varchar(10)

For the TL_dt  tried a dateandtime format but its not working at all it always retrieves an error... therefore i tried the varchar instead


0
DRISHTY

DRISHTY

NA 592 0 14y

Hi,
The error is  coming due to this sentence,
sSQL = "Insert into Transaction_Line (TransL_id,Trans_id, TL_dt, Pro_id, Quantity)" & _
"values('" & TransLid & "', '" & TLdte & "', '" & proID & "', '" & quan & "', '" & transID & "')"
 
In that u r trying to insert..
TransL_id (int)- > TransLid (int),
Trans_id (int) - > TLdte (date),
TL_dt (date) -> proID (int),
Pro_id - > quan ,
Quantity - > transID
0
Ankur Gupta

Ankur Gupta

NA 2k 982k 14y
Can you also post Transaction_Line table structure (Fields with DataType) ?