Insert Data from DataTable into text file

In Progress Posted 2 years ago Paid on delivery
In Progress Paid on delivery

Hello I have a simple project. I have a c# method that gets data from SQL store procedure, insert it into a text file and download it by a btn.

The issue is: the data from sql does not get inserted.

the text file and btn works fine and the method to get the data from sql also works fine.

public DataTable CreateRunOCR(int name1, int name2, int name3)

{

string sqlStatement = [login to view URL];

try

{

IDBContext eddsDBContext = [login to view URL](workspaceArtifactID);

SqlParameter DocumentArtifactParam = new SqlParameter("@name1", workspaceArtifactID);

sqlStatement = "[EDDSDBO].[CLCS_LSA001RL_GetWRBugText]" +

" @Prod_ArtifactID = " + @name2+

" ,@Combined_SavedSearch_ArtifactID = " + @name3;

DataSet ds = [login to view URL](sqlStatement, new SqlParameter[] { DocumentArtifactParam });

if ([login to view URL] > 0)

{

return [login to view URL][0];

}

else

{

return new DataTable();

}

}

catch (Exception ex)

{

return null;

}

Then I have a method to create text file:

public ActionResult CreateTextFile(DataTable wrInfo)

{

//DataTable dt = [login to view URL](currentWorkspaceId, [login to view URL](prodData), [login to view URL](savedSearchId));

var dblline = [login to view URL] + [login to view URL];

var line = [login to view URL];

// var stagingSummaries = (List<StagingSummary>)Session["stagingSummaries"];

StringBuilder strData = new StringBuilder();

[login to view URL](" " + line + " " + wrInfo + " " + dblline);

//This is for WR Number

var wrNumber = (string)Session["WRnumber"];

var byteArray = [login to view URL]([login to view URL]());

var stream = new MemoryStream(byteArray);

//Filename is wrNumber

string fName = ![login to view URL](wrNumber) ? wrNumber : "result";

return File(stream, "text/plain", fName + ".txt");

}

}

Then a btn to download it:

<input type="button" class="btn btn-primary" id="dwnldBtn" value="Download" />

//Download Text File

$("#dwnldBtn").click(function () {

//var link = [login to view URL] + '//' + [login to view URL] + "/Home/CreateTextFile?message=" + $("#txt").val();

[login to view URL]("/Relativity/CustomPages/15caf36e-d0dc-4fce-946e-55a0c0253e27/SecondPage/CreateTextFile", '_blank');

return false;

});

C# Programming .NET SQL ASP.NET Microsoft SQL Server

Project ID: #32694080

About the project

8 proposals Remote project Active 2 years ago

Awarded to:

ashiruddin

I am a well-experienced asp.net developer. I have read your project description with great interests, so that I feel 100% sure on it. I promise A+. I can get started right now and keep your timeline. I hope your kind m More

$30 USD in 1 day
(5 Reviews)
3.4

8 freelancers are bidding on average $27 for this job

mack06

Hello, I can review your solution to fix the problem just get in touch via chat and we can start! Regards, Jesus

$25 USD in 2 days
(12 Reviews)
4.9
burzhuy

Glad to meet you! I have the necessary knowledge and skills, an interest in work, and a long work experience behind me. I am ready for mutually beneficial cooperation!

$20 USD in 7 days
(1 Review)
3.3
bizmanas

Hi I have 15 years of experience in SQL server Database development, MySQL development, postgress SQL development, Python,C#, power bi. I will be able to help you with the project. Please ping me offline to discuss fur More

$56 USD in 1 day
(8 Reviews)
2.9
mahendrachoudha7

Hello, I have good experience in c# and SQL. I understood your requirement. I can help you in implementing it. Let's connect and discuss the details. Thanks

$20 USD in 1 day
(5 Reviews)
2.4
mahakabdulrazzak

Hello Hope you are doing good. I am a computer scientist and have a good knowledge in C#. Do send me your project so I can check/debug the problem. Thankyou

$20 USD in 7 days
(0 Reviews)
0.0
Arul313103

Hi, Am understanding your requirements. I solve that issue. I have very strong knowledge about c# , asp.net core web api and mvc ...etc..

$25 USD in 1 day
(0 Reviews)
0.0