Click here to Skip to main content
15,911,531 members
Home / Discussions / C#
   

C#

 
GeneralRe: c# Pin
stancrm10-Mar-08 2:16
stancrm10-Mar-08 2:16 
GeneralRe: c# Pin
Not Active10-Mar-08 2:40
mentorNot Active10-Mar-08 2:40 
GeneralEditControlShowing Pin
Nasir.Islam10-Mar-08 1:55
Nasir.Islam10-Mar-08 1:55 
GeneralRe: EditControlShowing Pin
LongRange.Shooter10-Mar-08 9:26
LongRange.Shooter10-Mar-08 9:26 
GeneralIP from NetworkInterface Pin
stancrm10-Mar-08 1:19
stancrm10-Mar-08 1:19 
GeneralRe: IP from NetworkInterface Pin
Scott Dorman10-Mar-08 4:59
professionalScott Dorman10-Mar-08 4:59 
Generalpop-up window sliding from top to down Pin
mnalammwb10-Mar-08 1:07
mnalammwb10-Mar-08 1:07 
QuestionHelp with reading 3 column csv Pin
kali0610-Mar-08 0:55
kali0610-Mar-08 0:55 
Hiya,

Dont kniow if anyone can help - but worth a shot. I am writing an app that takes in 3 values from 3 columns in a CSV (account number, start date, end date). The code i have at the mo only reads 1 column at a time, and i am not too sure how i can read the 3 values and pass them to the stored proc to get processed. The proc takes the values and processes them line by line. At the moment it reads all the column values and inserts it for accounts, date1a, and date2a, whereas i actually only need column 1 for accounts, column 2 for date1a, and column 3 for date2a. I would appreciate any feedback to get a solution as google is not my friend right now Smile | :) .

So far my code looks like this:

private void btnImport_Click(object sender, EventArgs e)
{
try
{
lblShowDetails.Text = "Importing accounts...";
this.Refresh();
DataSet ds = new DataSet();
if (ofd.ShowDialog() == DialogResult.OK)
{
FileStream fs = new FileStream(ofd.FileName, FileMode.Open);
StreamReader s = new StreamReader(fs);
StringBuilder sb = new StringBuilder();
while (s.Peek() >=0)
{
sb.Append("'" + s.ReadLine() + "',");
}

s.Close();
this.Cursor = Cursors.WaitCursor;
lblShowDetails.Text = "Retrieving data from the store...";
this.Refresh();

string accounts = sb.ToString().TrimEnd(",".ToCharArray());
string date1a = sb.ToString().TrimEnd(",".ToCharArray());
string date2a = sb.ToString().TrimEnd(",".ToCharArray());


try
{
ds.Tables.Clear();
if (sCustomer == "Customer1")
{

SqlDataAdapter da = new SqlDataAdapter("storedprocName", con);
da.SelectCommand.CommandTimeout = 0;
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.SelectCommand.Parameters.Add("@accounts", SqlDbType.VarChar);
da.SelectCommand.Parameters.Add("@date1", SqlDbType.DateTime);
da.SelectCommand.Parameters.Add("@date1", SqlDbType.DateTime);

da.Fill(ds, "xxx");
grdShowStats.DataSource = ds;
grdShowStats.DataMember = "xxx";

lblShowDetails.Text = "Done with Stats Enquiry...Waiting for next command";
GeneralRe: Help with reading 3 column csv Pin
PIEBALDconsult10-Mar-08 5:21
mvePIEBALDconsult10-Mar-08 5:21 
Generalsingle static instance in multi-thread env. Pin
buchstaben10-Mar-08 0:42
buchstaben10-Mar-08 0:42 
GeneralRe: single static instance in multi-thread env. Pin
Bekjong10-Mar-08 4:39
Bekjong10-Mar-08 4:39 
GeneralRe: single static instance in multi-thread env. Pin
LongRange.Shooter10-Mar-08 8:42
LongRange.Shooter10-Mar-08 8:42 
Generalmultiple selection listbox Pin
Ballita10-Mar-08 0:36
Ballita10-Mar-08 0:36 
GeneralRe: multiple selection listbox Pin
ChandraRam10-Mar-08 1:19
ChandraRam10-Mar-08 1:19 
GeneralRe: multiple selection listbox Pin
Ballita10-Mar-08 1:31
Ballita10-Mar-08 1:31 
GeneralRe: multiple selection listbox Pin
ChandraRam10-Mar-08 1:34
ChandraRam10-Mar-08 1:34 
Questionhow can we change the input locale programmatically using C# Pin
g_hemanth1710-Mar-08 0:22
g_hemanth1710-Mar-08 0:22 
GeneralRe: how can we change the input locale programmatically using C# Pin
ChandraRam10-Mar-08 1:29
ChandraRam10-Mar-08 1:29 
QuestionRe: how can we change the input locale programmatically using C# Pin
g_hemanth1710-Mar-08 18:09
g_hemanth1710-Mar-08 18:09 
QuestionFormBorderStyle set to None with Context Menu on taskbar? Pin
lordkaile10-Mar-08 0:22
lordkaile10-Mar-08 0:22 
GeneralSplitcontainer SplitterDistance increases in every time Pin
AndrusM10-Mar-08 0:09
AndrusM10-Mar-08 0:09 
GeneralRe: Splitcontainer SplitterDistance increases in every time Pin
LongRange.Shooter10-Mar-08 8:51
LongRange.Shooter10-Mar-08 8:51 
GeneralRe: Splitcontainer SplitterDistance increases in every time Pin
AndrusM11-Mar-08 7:53
AndrusM11-Mar-08 7:53 
GeneralRe: Splitcontainer SplitterDistance increases in every time Pin
LongRange.Shooter11-Mar-08 16:56
LongRange.Shooter11-Mar-08 16:56 
GeneralRe: Splitcontainer SplitterDistance increases in every time Pin
AndrusM12-Mar-08 2:40
AndrusM12-Mar-08 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.