I have resolved this issue by reading an asp lablel key into a dictionary. then if the dictionary had that label insert into my database. Sorry if I was vague but I'm very new to all of this so I mostly i just make others made by asking inane questions that are apparently to unclear to understand. :(
RickSharp
Posts
-
GridView FindControl LINQ Update -
GridView FindControl LINQ UpdateThanks for the insight. I'll go reread my C# manual... So i read it, and I guess I'm too stupid to understand it. Maybe someone else can help.
-
GridView FindControl LINQ UpdateThe only way I know how to refer to a checkbox in a TemplateField is by using GridViewRow in a foreach loop. If there is another way to find that control then i would love to know.
-
GridView FindControl LINQ UpdateThis link shed a little light, but still confused how to implement it. http://stackoverflow.com/questions/1233916/linq-find-all-checked-checkboxes-in-a-gridview[^]
-
GridView FindControl LINQ UpdateHey Guys, I know I can access my ItemTemplated Checkbox this way:
foreach (GridViewRow rowItem in GridView1.Rows)
{CheckBox ckBxSelect = ((CheckBox)rowItem.FindControl("chkBxSelect")); // chk.checked will access the checkbox state on button click event if (ckBxSelect.Checked) { Response.Write("True"); }
}
Ive built 1 LINQ object joined from 2 Datatables which comes from 2 WebServices. My GridView is bound to my LINQ object. When the user clicks submit, a foreach loop inserts that LINQ object into my database like so:
protected void Button1_Click(object sender, EventArgs e)
{
mySQLDatabaseDataContext dbc = new mySQLDatabaseDataContext("Data Source=JBBBZ7V1\\SQLEXPRESS;Initial Catalog=WLSData;Integrated Security=True");mySQLTableName newRecord; foreach (var item in LINQobject) { newRecord = new mySQLTableName(); newRecord.CustName = forAppr.custName; newRecord.Status = ""; newRecord.DateTimeSubmitted = DateTime.Now; dbc.mySQLTableName.InsertOnSubmit(newRecord); } dbc.SubmitChanges();
}
Like I said, my checkbox is in a TemplateField like so:
<HeaderTemplate> </HeaderTemplate> <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
When I am inserting from my LINQ object, I would like the "Status" field to update with "True" if checkbox is checked or "False" if checkbox is not checked. Like so:
protected void Button1_Click(object sender, EventArgs e)
{
mySQLDatabaseDataC -
DataSet to Dictionary Join?Huor, Thank so much for your time. This is very helpful and at least sends me in the right direction! It seems like most experienced programmers are too jaded to offer help here. Like giving a handout to a poor person that hasn't helped themselves. Like I'm just looking for a handout because I'm too stupid to google or use the "search" features. "Oh please Mr programming constultant, help me for free, please, my family is dying from starvation and and...my dog has fleas...I need more code" "Begone peasant!! I have no time for new coders! I'm solving much higher and more important recursion problems and pointer issues! Why don't you use the search feature." Bah!
-
DataSet to Dictionary Join?No idea how to achieve all of that. Sorry. Beginner here. But your enthusiasm is, nice.
-
DataSet to Dictionary Join?Do you mean like this? public class Companies { public static String Company1 { get { return "Company1";}} public static String Company1City { get { return "Company1City";}} public static String Company1State { get { return "Company1State";}} public static String Company2 { get { return "Company2";}} public static String Company2City { get { return "Company2City";}} public static String Company2State { get { return "Company2State";}} } or like this? Public Class Company1 { } Public Class Company2 { }
-
DataSet to Dictionary Join?Hello all, I have 2 Datasets. I've already asked how to join 2 DataSets and didn't get any answers that helped me. So I feel the easiest way to associate them now is to create a dictionary(s) for DataSet2. The 2 different DataSets have only 1 field in common, CompanyName. So enter dicitonary. DataSet 2 contains only 16 total records (Company). Each record (Company) has 7 rows: Company1 Carrington Mortgage Services, LLC 1610 E. Saint Andrew Place B150 Santa Ana CA 92705 So when CompanyName matches, return value from Dictionary. Do i need to create 16 Dicitonary entires with Key and Value? Do i create 1 Dictionary with variables populating on some kind of for loop? I was told that i could create my own class to store the information I need or simply set the dataset record as the value. No idea what any of those things mean. :(
-
Joining 2 DataSetsHello all, I have 2 datasets from 2 different Web Services and reading them into DataSets: DataSet dsLoans = new DataSet(); dsLoans.ReadXml(XmlReader.Create(new StringReader(myWLSreference.GetCustomLoanExport2()))); DataSet dsCompany = new DataSet(); dsCompany.ReadXml(XmlReader.Create(new StringReader(myWLSreference.GetCustomCompanyExport2()))); I have done multiple searches and have come across: http://forums.asp.net/t/1708173.aspx/1?how+can+i+inner+join+tables+within+DATASET+[^] http://stackoverflow.com/questions/10502512/c-sharp-datatable-inner-join-with-dynamic-columns?lq=1[^] http://support.microsoft.com/kb/326080/en-us[^] But no joy yet. I have searched and searched. I cant use Datatables because i'm reading the dataset into a List<> with a foreach statement like so:
foreach (DataRow row in JoinedDataSet.Tables["Loan"].Rows)
{WireEntryLoan newEntryLoan = new WireEntryLoan(); newEntryLoan.custName = row\["MtgeeLoanName"\].ToString(); newEntryLoan.loanWLSID = row\["LoanNumber"\].ToString();
Then binding that to GridView. How in the world can I join 2 DataSets on a common field?!
-
XML Mapping to CSVHmmm Ok. Thanks for the brainstorming. Guess i dont need a dataset at all if XLST can give me both displaying the data in a meaningful manner front end while also being able to convert the data and spitting it out to a file, which it sounds like it can. I look into it until you get back to me. :)
-
XML Mapping to CSVActually thats a good question. Because I'm not really wanting the end file to be a CSV file. The end file should be in FedWire Format. http://www.frbservices.org/campaigns/remittance/files/fedwire_funds_format_reference_guide.pdf[^] I just figured it would be easier to get to my end result with a CSV file to work with. Basically I'm taking that Web Service. Iterating through the tables. Then ultimately spitting out a file in that format. {1015} blah blah blah {1870} blah blah blah
-
dropdown issueIIII
-
XML Mapping to CSVActually this might be more what I'm looking for:
public class WireEntry
{
public String Name { get; set; }
public String Number { get; set; }
public String BankName { get; set; }
public String ClosingNo { get; set; }public WireEntry() { }
}
foreach (DataRow row in ds.Tables["Loan"].Rows)
{// Enter into result set WireEntry newEntry = new WireEntry(); newEntry.Name = row\["Name"\].ToString(); newEntry.Number = row\["Number"\].ToString(); newEntry.BankName = row\["BankName"\].ToString(); result.Add(newEntry); } return result;
-
XML Mapping to CSVHello, I have a fixed XML table thats coming from a Web Service.
JOHNSON, DANIEL R.
BMRES-550
Bank of America
123456
49,7560.8600I need to convert the XML data to CSV. The data to be converted has commas. So the below method doesn't work:
using (StreamWriter writer = File.CreateText("C:\\username\\password\\Desktop\\Export.csv"))
{
DataSet ds = new DataSet();
ds.ReadXml(XmlReader.Create(new StringReader(myWebreference.GetWebServiceMethod("username", "password1", "Export", "Parameter4", DateTime.Today, DateTime.Today, ""))));writer.WriteLine(string.Join(",", ds.Tables\["Loan"\].Columns.Cast().Select(col => col.ColumnName).ToArray())); foreach (DataRow row in ds.Tables\["Loan"\].Rows) { writer.WriteLine(string.Join(",", row.ItemArray.Cast().ToArray())); } }
-
DataGridView doesn't appear on screenBy entry point do you mean is it just a win form, exe or class library? If so I have added a form project and console application project to my solution. So I have a class library that contains that code. I added a reference to that class library in the new forms and console projects that I created. I tried following this tutorial with no success. http://www.dotnetperls.com/datagridview-tutorial[^]
-
DataGridView doesn't appear on screenHey guys, Easy one here. I want to see the results of my datatable in the DataGridView. When i execute, it runs without errors but no DataGridView shows up on screen. Does DataGridView require a form to view the results or something? What am I missing?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FileHelpers;
using System.Data; //not used by default
using System.IO; //not used by default
using System.Data.OleDb; //not used by default
using System.Windows.Forms;namespace CSVParser
{
class CSVParser
{
public static DataTable ParseCSV(string path)
{
if (!File.Exists(path))
return null;string full = Path.GetFullPath(path); string file = Path.GetFileName(full); string dir = Path.GetDirectoryName(full); //create the "database" connection string string connString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=\\"" + dir + "\\\\\\";" + "Extended Properties=\\"text;HDR=No;FMT=Delimited\\""; //create the database query string query = "SELECT \* FROM " + @"C:\\Users\\rsharp\\Desktop\\CustomerExport.csv"; //create a DataTable to hold the query results DataTable dTable = new DataTable(); //create an OleDbDataAdapter to execute the query OleDbDataAdapter dAdapter = new OleDbDataAdapter(query, connString); //try // { //fill the DataTable dAdapter.Fill(dTable); // } //catch (InvalidOperationException /\*e\*/) // { } //the DataGridView DataGridView dgView = new DataGridView(); //BindingSource to sync DataTable and DataGridView BindingSource bSource = new BindingSource(); //set the BindingSource DataSource bSource.DataSource = dTable; //set the DataGridView DataSource dgView.DataSource = bSource; //Dispoe of the adapter dAdapter.Dispose(); return dTable; } }
}