PDF file contents write into it after creating the PDF on Azure Storage - azure-storage

I have created a pdf file on azure storage and now i want to write few contents into the pdf file .
Is it possible so? If yes kindly help me in this regard
Thank You
if not TempBlob.Blob.HasValue() then
exit;
WMSMgmt.FindSet();
cha[1] := 10;
msVersion := '2015-02-21';
keyss := WMSMgmt."Azure Key"; //GetAccountAccessKey();
dateInRfc1123Format := GetUTCDateTimeText(); // <------------ Changed
requestMethod := 'PUT';
urlPath := WMSMgmt."Azure Lable Share Name" + '/' + FileName + '?comp=range';//'lables/'
CanonicalizedResource := ConvertStr(StrSubstNo('/%1/%2', WMSMgmt."Azure Storage Account Name", urlPath), '?=', cha + ':');
TempBlob.Blob.CreateInStream(InStr, TextEncoding::UTF8);
content.WriteFrom(InStr);
ContentLength := TempBlob.Blob.Length;
ContentHeaders.Clear();
content.GetHeaders(ContentHeaders);
ContentHeaders.Add('Content-Length', Format(ContentLength, 0, 9));
ContentHeaders.Remove('Content-Type');
request.Content := content;
Range := 'bytes=0-' + Format(contentLength - 1, 0, 9);
canonicalizedHeaders := 'x-ms-date:' + dateInRfc1123Format + Format(cha) +
'x-ms-range:' + Range + Format(cha) +
'x-ms-version:' + msVersion + Format(cha) +
'x-ms-write:' + 'update';
stringToSign := (requestMethod + Format(cha) +
Format(cha) +
Format(cha) +
Format(contentLength, 0, 9) + Format(cha) +
Format(cha) +
Format(cha) +
Format(cha) +
Format(cha) +
Format(cha) +
Format(cha) +
Format(cha) +
Format(cha) +
canonicalizedHeaders + Format(cha) + // <------------ Changed
canonicalizedResource);
authorizationHeader := 'SharedKey ' + WMSMgmt."Azure Storage Account Name" + ':' + EncryptionManagement.GenerateBase64KeyedHashAsBase64String(stringToSign, keyss, 2);
uri := StrSubstNo('https://%1.file.core.windows.net/%2', WMSMgmt."Azure Storage Account Name", urlPath);
request.SetRequestUri(uri);
request.Method := requestMethod;
RequestHeader.Clear();
request.GetHeaders(RequestHeader);
RequestHeader.Add('Authorization', authorizationHeader);
RequestHeader.Add('x-ms-date', dateInRfc1123Format);
RequestHeader.Add('x-ms-range', Range);
RequestHeader.Add('x-ms-version', msVersion);
RequestHeader.Add('x-ms-write', 'update');
client.Send(request, hhtpres);
if not hhtpres.IsSuccessStatusCode then
Error(hhtpres.ReasonPhrase);
This is writing contents to a file on azure storage for all formats other than PDF. I want to write contents to PDF file

Related

Delphi syntax error in FROM clause but - there's no FROM clause

I'm using the insert function in SQL code for Delphi. The program compiles and runs however, upon clicking the button which executes the insert function I receieve a message saying
Syntax error in FROM clause.
Upon breaking the program, it highlights the last line of code before end. If I were to remove that line of code and re-run the program, I am greeted with the same error and upon breaking it highlights the end; of the buttonclick procedure.
Please keep in mind that I am still a student and a novice to this language.
ADOQuery1.Close;
ADOQuery1.SQL.Add('insert into FPS_Tbl([MatchID],[kills],[standings],[GrenadeKill],[TimePlayed],[Username],[Comments],[Headshots],[Dates])');
ADOQuery1.SQL.Add('values("'+IntToStr(ids)+'","'+IntToStr(Kills)+'","'+standings+'","'+IntToStr(grenKills)+'","'+times+'","'+user+'","'+comment+'","'+IntToStr(HedShots)+'","'+DateToStr(Now)+'");');
ADOQuery1.ExecSQL;
end;
recalls;
recalls is a procedure for displaying the contents of the table in a Richedit.
Not really sure as to why I am getting this error as there is no 'From' clause in my SQL statements. To those who do assist Thank you very much.
try to insert simple space to separate (last word in first add) and (first word in second add), may like so:
ADOQuery1.SQL.Add(' values("'+IntToStr(ids)+'","'+IntToStr(Kills)+'","'+standings+'","'+IntToStr(grenKills)+'","'+times+'","'+user+'","'+comment+'","'+IntToStr(HedShots)+'","'+DateToStr(Now)+'");');
When invoking a multi-line SQL query, you need to Clear() the SQL before you then Add() lines to it, otherwise you will be adding on to a previous query:
ADOQuery1.Close;
ADOQuery1.SQL.Clear; // <-- ADD THIS!!!
ADOQuery1.SQL.Add('insert into FPS_Tbl([MatchID],[kills],[standings],[GrenadeKill],[TimePlayed],[Username],[Comments],[Headshots],[Dates])');
ADOQuery1.SQL.Add('values("' + IntToStr(ids) + '","' + IntToStr(Kills) + '","' + standings + '","' + IntToStr(grenKills) + '","' + times + '","' + user + '","' + comment + '","' + IntToStr(HedShots) + '","' + DateToStr(Now) + '");');
ADOQuery1.ExecSQL;
Otherwise, use the Text property instead:
ADOQuery1.Close;
ADOQuery1.SQL.Text := 'insert into FPS_Tbl([MatchID],[kills],[standings],[GrenadeKill],[TimePlayed],[Username],[Comments],[Headshots],[Dates]) values("' + IntToStr(ids) + '","' + IntToStr(Kills) + '","' + standings + '","' + IntToStr(grenKills) + '","' + times + '","' + user + '","' + comment + '","' + IntToStr(HedShots) + '","' + DateToStr(Now) + '");');
ADOQuery1.ExecSQL;
That said, your code is subject to an SQL Injection attack. You can avoid that by using AnsiQuotedStr() for all string inputs:
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('insert into FPS_Tbl([MatchID],[kills],[standings],[GrenadeKill],[TimePlayed],[Username],[Comments],[Headshots],[Dates])');
ADOQuery1.SQL.Add('values("' + IntToStr(ids) + '","' + IntToStr(Kills) + '",' + AnsiQuotedStr(standings,'"') + ',"' + IntToStr(grenKills) + '",' + AnsiQuotedStr(times,'"') + ',' + AnsiQuotedStr(user,'"') + ',' + AnsiQuotedStr(comment,'"') + ',"' + IntToStr(HedShots) + '","' + DateToStr(Now) + '");');
ADOQuery1.ExecSQL;
Or better, by using a parameterized query instead:
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('insert into FPS_Tbl([MatchID],[kills],[standings],[GrenadeKill],[TimePlayed],[Username],[Comments],[Headshots],[Dates])');
ADOQuery1.SQL.Add('values(:PId,:PKills,:PStandings,:PGrenKills,:PTimes,:PUser,:PComment,:PHeadShots,:PDate);');
ADOQuery1.Parameters.ParamByName('PId').Value := IntToStr(ids);
ADOQuery1.Parameters.ParamByName('PKills').Value := IntToStr(Kills);
ADOQuery1.Parameters.ParamByName('PStandings').Value := standings;
ADOQuery1.Parameters.ParamByName('PGrenKills').Value := IntToStr(grenKills);
ADOQuery1.Parameters.ParamByName('PTimes').Value := times;
ADOQuery1.Parameters.ParamByName('PUser').Value := user;
ADOQuery1.Parameters.ParamByName('PComment').Value := comment;
ADOQuery1.Parameters.ParamByName('PHeadShots').Value := IntToStr(HedShots);
ADOQuery1.Parameters.ParamByName('PDate').Value := DateToStr(Now);
ADOQuery1.ExecSQL;

SQL query works in Access Database but not in Delphi 7

procedure TformVet.sdaClick(Sender: TObject);
var anID, anT, anN, anG, anSp, anSi, anDR, anDF, anPD, anTr, anO : String;
anRID, anRT, anRN, anRG, anRSp, anRSi, anRDR, anRDF, anRPD, anRTr, anRO : String;
begin
ShowMessage('If you are not searching for a specific group of data, leave the input field empty!');
anID := InputBox('Animal ID','What is the ID of the Animal you are searching for?','');
anT := InputBox('Animal Type','What is the type of Animal you are searching for?','');
anN := InputBox('Animal Name','What is the name of the Animal you are searching for?','');
anG := InputBox('Animal Genus','What is the genus of the Animal you are searching for?','');
anSp := InputBox('Animal Species','What is the species of the Animal you are searching for?','');
anSi := InputBox('Animal Sickness','What is the sickness of the Animal you are searching for?','');
anDR := InputBox('Date Received','What is the date received of the Animal you are searching for?','');
anDF := InputBox('Date Fetched','What is the date fetched of the Animal you are searching for?','');
anPD := InputBox('Paid','What is the status of payment of the Animal''s treatment that you are searching for? (Yes/No)','');
anTr := InputBox('Treatment','What is the cost of the treatment you are searching for?','');
anO := InputBox('Owner ID','What is the ID of the Owner you are searching for?','');
if getLen(anID) > 0 then
anRID := '(AnimalID = ' + anID + ')'
else
anRID := '(AnimalID LIKE "*")';
if getLen(anT) > 0 then
anRT := '(anType = "' + anT + '")'
else
anRT := '(anType LIKE "*")';
if getLen(anN) > 0 then
anRN := '(anName = "' + anN + '")'
else if getLen(anN) = 0 then
anRN := '(anName LIKE "*")';
if getLen(anG) > 0 then
anRG := '(anGenus = "' + anG + '")'
else
anRG := '(anGenus LIKE "*")';
if getLen(anSp) > 0 then
anRSp := '(anSpecie = "' + anSp + '")'
else
anRSp := '(anSpecie LIKE "*")';
if getLen(anSi) > 0 then
anRSi := '(anSick = "' + anSi + '")'
else
anRSi := '(anSick LIKE "*")';
if getLen(anDR) > 0 then
anRDR := '(anDateRec = "' + anDr + '")'
else
anRDR := '(anDateRec LIKE "*")';
if getLen(anDF) > 0 then
anRDF := '(anDateFet = "' + anDf + '")'
else
anRDF := '(anDateFet LIKE "*")';
i := 1;
While i = 1 do
begin
if UpperCase(anPD) = 'YES' then
begin
anRPD := '(anPaid = "-1")';
i := 0;
end
else if UpperCase(anPD) = 'NO' then
begin
anRPD := '(anPaid = "0")';
i := 0;
end
else if getLen(anPD) = 0 then
begin
anRPD := '(anPaid LIKE "*")';
i := 0;
end
else
ShowMessage(anPD + ' is not a valid query!');
end;
if getLen(anTr) > 0 then
anRTr := '(anTreat = ' + anTr + ')'
else
anRTr := '(anTreat LIKE "*")';
if getLen(anO) > 0 then
anRO := '(OwnerID = ' + anO + ')'
else
anRO := '(OwnerID LIKE "*")';
SS := 'SELECT * FROM tblAnimal ';
SS := SS + 'WHERE ' + anRT + ' AND ' + anRN + ' AND ' + anRT + ' AND ' + anRG + ' AND ' + anRSp + ' AND ' + anRSi + ' AND ' + anRDR + ' AND ' + anRDF + ' AND ' + anRPD + ' AND ' + anRTr + ' AND ' + anRO + ';';
adoAnimal.Close;
adoAnimal.SQL.Text := SS;
adoAnimal.ExecSQL;
adoAnimal.Open;
end;
This is my code for the search button which is suppose to find records with the specified data but it does not work. The query when run in delphi however returns with no results even if you do not enter any data.
This is the SQL query which runs when no data is entered:
SELECT * FROM tblAnimal WHERE (anType LIKE "*") AND (anName LIKE "*") AND (anType LIKE "*") AND (anGenus LIKE "*") AND (anSpecie LIKE "*") AND (anSick LIKE "*") AND (anDateRec LIKE "*") AND (anDateFet LIKE "*") AND (anPaid LIKE "*") AND (anTreat LIKE "*") AND (OwnerID LIKE "*");
This is for a high school project and any help would be highly appreciated!
`
Don't use doble quotes to delimiter your strings, but simple quotes. Single quotes are the standar SQL to quote strings, and your Delphi components probably expect them. Also the standar wildcard to represent any characters is %, not *.
To specify a simple quote within a Delphi string, you have to write two simple quotes :
procedure TformVet.sdaClick(Sender: TObject);
var anID, anT, anN, anG, anSp, anSi, anDR, anDF, anPD, anTr, anO : String;
anRID, anRT, anRN, anRG, anRSp, anRSi, anRDR, anRDF, anRPD, anRTr, anRO : String;
begin
ShowMessage('If you are not searching for a specific group of data, leave the input field empty!');
anID := InputBox('Animal ID','What is the ID of the Animal you are searching for?','');
anT := InputBox('Animal Type','What is the type of Animal you are searching for?','');
anN := InputBox('Animal Name','What is the name of the Animal you are searching for?','');
anG := InputBox('Animal Genus','What is the genus of the Animal you are searching for?','');
anSp := InputBox('Animal Species','What is the species of the Animal you are searching for?','');
anSi := InputBox('Animal Sickness','What is the sickness of the Animal you are searching for?','');
anDR := InputBox('Date Received','What is the date received of the Animal you are searching for?','');
anDF := InputBox('Date Fetched','What is the date fetched of the Animal you are searching for?','');
anPD := InputBox('Paid','What is the status of payment of the Animal''s treatment that you are searching for? (Yes/No)','');
anTr := InputBox('Treatment','What is the cost of the treatment you are searching for?','');
anO := InputBox('Owner ID','What is the ID of the Owner you are searching for?','');
if getLen(anID) > 0 then
anRID := '(AnimalID = ' + anID + ')'
else
anRID := '(AnimalID LIKE ''%'')';
if getLen(anT) > 0 then
anRT := '(anType = ''' + anT + ''')'
else
anRT := '(anType LIKE ''%'')';
if getLen(anN) > 0 then
anRN := '(anName = ''' + anN + ''')'
else if getLen(anN) = 0 then
anRN := '(anName LIKE ''%'')';
if getLen(anG) > 0 then
anRG := '(anGenus = ''' + anG + ''')'
else
anRG := '(anGenus LIKE ''%'')';
if getLen(anSp) > 0 then
anRSp := '(anSpecie = ''' + anSp + ''')'
else
anRSp := '(anSpecie LIKE ''%'')';
if getLen(anSi) > 0 then
anRSi := '(anSick = ''' + anSi + ''')'
else
anRSi := '(anSick LIKE ''%'')';
if getLen(anDR) > 0 then
anRDR := '(anDateRec = ''' + anDr + ''')'
else
anRDR := '(anDateRec LIKE ''%'')';
if getLen(anDF) > 0 then
anRDF := '(anDateFet = ''' + anDf + ''')'
else
anRDF := '(anDateFet LIKE ''%'')';
i := 1;
While i = 1 do
begin
if UpperCase(anPD) = 'YES' then
begin
anRPD := '(anPaid = ''-1'')';
i := 0;
end
else if UpperCase(anPD) = 'NO' then
begin
anRPD := '(anPaid = ''0'')';
i := 0;
end
else if getLen(anPD) = 0 then
begin
anRPD := '(anPaid LIKE ''%'')';
i := 0;
end
else
ShowMessage(anPD + ' is not a valid query!');
end;
if getLen(anTr) > 0 then
anRTr := '(anTreat = ' + anTr + ')'
else
anRTr := '(anTreat LIKE ''%'')';
if getLen(anO) > 0 then
anRO := '(OwnerID = ' + anO + ')'
else
anRO := '(OwnerID LIKE ''%'')';
SS := 'SELECT * FROM tblAnimal ';
SS := SS + 'WHERE ' + anRT + ' AND ' + anRN + ' AND ' + anRT + ' AND ' + anRG + ' AND ' + anRSp + ' AND ' + anRSi + ' AND ' + anRDR + ' AND ' + anRDF + ' AND ' + anRPD + ' AND ' + anRTr + ' AND ' + anRO + ';';
adoAnimal.Close;
adoAnimal.SQL.Text := SS;
adoAnimal.ExecSQL;
adoAnimal.Open;
end;
This shouldn't be used on a real environment, because it can be attacked with SQL injection. But as an school work it probably is fine (although your teacher will be happy if you comment it).
Read more about SQL injection, it's very important that you don't use this kind of code on a production environment (instead you should be using parameters) : https://arstechnica.com/information-technology/2016/10/how-security-flaws-work-sql-injection/

Script returns error 429 when used on a big spreadsheet (more than 5 sheets)

I get an error 429 "Too many requests" with this script.
The script is functional with 4 or 5 sheets in the spreadsheet... but when I try on my spreadsheet with 15+ sheets it return an error "Too many requests".
How can I fix this problem please ?
PS : it's a script that I have taken from your website.
With this script, I need to take a sheet (by name) and download it to PDF and send to a specific folder in the drive.
I have 5 identical scripts, with the name changed for the PDF needed.
In one of the scripts, I need two files.
function PDF4( optSSId, optSheetId )
var ss = SpreadsheetApp.getActiveSpreadsheet();
var url1 = ss.getUrl().replace(/edit$/,'');
var Ref = ss.getSheetByName('Caché 2').getRange('E8').getValues()
var name = ss.getSheetByName('Budget').getRange('C10').getValues()
var factnumb = ss.getSheetByName('Facture Intermédiaire BIS').getRange('C16').getValues()
var htva = ss.getSheetByName('Facture Intermédiaire BIS').getRange("H24").getValues();
var tva = ss.getSheetByName('Facture Intermédiaire BIS').getRange("G25").getValues();
var total = ss.getSheetByName('Facture Intermédiaire BIS').getRange("H26").getValues();
var INVFolder = ss.getSheetByName('Liste').getRange('H8').getValues()
var folder = DriveApp.getFolderById(INVFolder).createFolder(factnumb + ' - ' + Ref + ' - ' + name)
var Blist = ss.getSheetByName("Liste").getRange('H2').getValues()
var sp2 = SpreadsheetApp.openById(Blist).getSheetByName("Liste");
var target = sp2.getLastRow(); sp2.getRange(target+1,1,name.length,name[0].length).setValues(name);
var cols = sp2.getActiveCell().getColumn();
var colsplus = cols + 1;
var colsplus2 = cols + 2;
var colsplus3 = cols + 3;
var colsplus4 = cols + 4;
var igi = sp2.getRange(target+1,colsplus);
igi.setValues(factnumb);
var htv = sp2.getRange(target+1,colsplus2);
htv.setValues(htva);
var tv = sp2.getRange(target+1,colsplus3);
tv.setValues(tva);
var tot = sp2.getRange(target+1,colsplus4);
tot.setValues(total);
var no = sp2.getRange(target+1,cols);
no.setValues(name);
var sheets = ss.getSheets();
for (var i=0; i<sheets.length; i++) {
var sheet = sheets[i];
if (optSheetId && optSheetId !== sheet.getSheetId()) continue;
var url_ext = 'export?exportFormat=pdf&format=pdf'
+ '&gid=' + sheet.getSheetId()
// following parameters are optional...
+ '&size=letter'
+ '&portrait=true'
+ '&fitw=true'
+ '&sheetnames=false&printtitle=false&pagenumbers=false'
+ '&gridlines=false'
+ '&fzr=false';
var url = url1 + url_ext
var options = {
headers: {
'Authorization': 'Bearer ' + ScriptApp.getOAuthToken()
}
}
var response = UrlFetchApp.fetch(url, options);
var blob = response.getBlob().setName(ss.getName() + ' - ' + sheet.getName() + '.pdf');
folder.createFile(blob); }
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Récap.CDE' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Caché' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Caché 2' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Budget' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Budget Mini' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Métré MOD' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'CDC - Regroupement' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'CDC' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Planning' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Liste' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Prestataires' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Suppléments' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Dim.Pièces' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Dimensions pièces mini' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Feuille 22' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'MOD' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'CDC Prestataires' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Métré Prestataires' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Facture Acompte' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Facture Solde' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Facture Intermédiaire' + '.pdf').next().setTrashed(true);
DriveApp.getFilesByName(ss.getName() + ' - ' + 'Devis' + '.pdf').next().setTrashed(true);
var newname = factnumb + ' - ' + Ref + ' - ' + name + '.pdf'
var file = DriveApp.getFilesByName(ss.getName() + ' - ' + 'Facture Intermédiaire BIS' + '.pdf').next()
file.setName(newname) }
Thanks a lot for your answers,
Is it OK with the format of my question now ?
I think there is a problem cause I've tried to select less than 5 sheets with for (var i=0; i<sheets.length - 17; i++) (My spreadsheet have 23 different sheets)
It work some times... but it continues to send me the same error some times...

Eliminating multiple delimiters in single column in oracle

My table has single column info
Info
+aname + + + + + + +ano+ + + + + + + + + +agender+ + + + + + + + + + + + +arace
I should get output like
aname+ano+agender+arace
I have to eliminate multiple delimiters and replace with single +
I tried with regexp_replace and trim and working as below
select trim(REGEXP_REPLACE('+aname + + + + + + +
+ano + + + + + + + +
+agender+ + + + + + + + + + +
+arace', '\ + + ', '+'),'+') from dual;
i get output as
aname+++++++ano+++++++agender++++++++++arace
This regexp does the trick: '\++'
select REGEXP_REPLACE('+aname++++++ano+++++++++agender++++++++++++arace', '\++', '+') from dual;
To get rid of the leading + (like in your example), use ltrim (or trim to remove trailing + too).
select ltrim(REGEXP_REPLACE('+aname++++++ano+++++++++agender++++++++++++arace', '\++', '+'),'+') from dual;

OLEDB Jet 4.0 SQL Character Limit

I am attempting to generate lines for an SDF (Space Delimited File). I am creating these lines from a DBASE IV DBF file using an OLEDB adapter with extended properties DBASEIV to get at the data. My data column output is 425 characters long after padding, I am placing this into a datagridview in VB.NET to display it.
However when I run my query, while it seems to execute correctly the resultant field is restricted to 256 characters. The longest individual field I am reading is 35 characters and I am returning a dataset with 2 fields, the barcode and the SDF line. As I understand it OLEDB Jet 4.0 tries to guess the type based on the first 8 rows, however as all rows are equal length for the data column (425 chars) I don't get why it is choosing the smaller field type. I assume it is because my field is a generated one using string concatenation. I have included the horrible SQL at the bottom of this question. So my question is how can I get the full 425 character output? Or is there a way I can specify the datatype for my own field as memo?
SELECT scan,
RIGHT('0000000000000' + trim(cstr(scan)), 13) +
LEFT(trim(cstr(name)) + ' ', 35) +
LEFT(trim(cstr(name)) + ' ', 16) +
' ' +
' ' +
' ' +
'1 ' +
'0.00 ' +
'0.00 ' +
'1' +
'0.00 ' +
'0.01 ' +
'0.00 ' +
'F' +
'2' +
'0.00 ' +
'0.00 ' +
' ' +
' ' +
' ' +
'SALS' +
' ' +
' ' +
LEFT(trim(cstr(plof)) + ' ', 13) +
' ' +
' ' +
'0.00 ' +
'0.00 ' +
'0.00 ' +
'F' +
'T' +
'001' +
' ' +
'T' +
'01' +
' ' +
' ' +
' ' +
' ' +
'F' +
'F' +
' ' +
' ' +
'0 ' +
'0.00 ' +
' ' +
'0 ' +
'0.00 ' +
'0.00 ' +
'0.00 ' +
'0.00 ' +
'1 ' +
'1 ' +
'1 ' +
'0.00 ' +
'0.00 ' +
'0.00 ' +
'0.00 ' +
'0.00 ' +
'0.00 ' +
' ' +
' ' +
' '
as STTEMPLINE
from salus where cstr(scan) in (select distinct cstr(scan) from nonscan)
Thanks in advance for any help.
This is a known issue where data types are guessed based on data in the first few rows.
See this post...
Load Excel sheet into DataTable but only the first 256 chars per cell are imported,
Also, see this post for an explanation of how OLEDB deals with mixed data types...
http://social.msdn.microsoft.com/Forums/pl-PL/csharplanguage/thread/0404d003-5bfb-44f9-8e6b-aebdfce24875