Jump to content
Xtreme .Net Talk

jcrcarmo

Avatar/Signature
  • Posts

    32
  • Joined

  • Last visited

jcrcarmo's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hello everyone, I used to have my MS Access 2002 DataBase placed in my application folder and connect to it through an OLEDB connection. Everything worked fine. Now I decided to create an ODBC DataSource and suddenly I'm not able to pass parameters to the SQL Query the way I used to with the OLEDB connection. Here's a sample code of the SQL Query and C# code on my form: FillByClienteDataNumero query: SELECT Data, Cliente, Tipo, Número, Espécie, Lote, Análise, Preço FROM qryALL1 WHERE (Cliente = ?) AND (Data >= ?) AND (Data <= ?) AND (Tipo = ?) ORDER BY Data, Número Form code: private void btnSeekBA_Click(object sender, EventArgs e) { try { this.qryALL1TableAdapter.FillByClienteDataTipo(this.sascrDataSet.qryALL1, cbCliente.Text, new System.Nullable<System.DateTime>(((System.DateTime)(System.Convert.ChangeType(DataIni.Text, typeof(System.DateTime))))), new System.Nullable<System.DateTime>(((System.DateTime)(System.Convert.ChangeType(DataFin.Text, typeof(System.DateTime))))), "Boletim"); } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } } Any ideas why the above SQL query and code work with an OLEDB connection but not with an ODBC DataSource? Thanks a million! JC.
  2. Hello everyone, Where exactly do I configure a C# application to install in a specific path? Like, for example: C:\Program Files\myApp Please note that I don't mean the deployment folder! I looked throughout the application properties, publish properties and publish Wizard, but didn't find a configuration option for that. Thanks a lot, JC.
  3. Hello to all, When I'm running my application from the debug folder, I'm able to save changes to the database, but when I load the Crystal report to display that data, it still displays the old data, i.e., the data before the changes. Does it have anything to do with the database Build Action property and Copy property or it has something to do with the report source path? Thanks a lot, JC.
  4. Hi Cags, That's exactly it, but the problem has been solved. It was pathetically simple... All I had to do was set the reports file property "Build Action" to "Content". Now everything is ok. Thanks a lot! JC
  5. Hello everyone, After I publish my C# VS2005 application (to be installed from CD-ROM), the crystal reports in it will not load, but if I run the application from debug, everything works fine. Does anybody know what's going on? Thanks a lot. Best regards, JC
  6. Hello everyone, As shown in the code below, is it possible for me to add the new objects for tipoDT and sementesDT without having to do it one-by-one? Like, for example, getting the values automatically from the tables?.... How would I do that? The sementesDT table is quite large and would take me forever to add the new objects one-by-one! Here's the code: public frmBA() { tipoDT = new DataTable("tabTipoSemente"); tipoDT.Columns.Add("CodTipo", typeof(int)); tipoDT.Columns.Add("Tipo", typeof(string)); tipoDT.Rows.Add(new object[] { 0, "Nocivas Probidas" }); tipoDT.Rows.Add(new object[] { 1, "Nocivas Toleradas" }); tipoDT.Rows.Add(new object[] { 2, "Sementes Silvestres" }); sementesDT = new DataTable("tabSementes"); sementesDT.Columns.Add("CodSemente", typeof(int)); sementesDT.Columns.Add("CodTipo", typeof(int)); sementesDT.Columns.Add("Semente", typeof(string)); sementesDT.Rows.Add(new object[] { 0, 0, "SubCat0-Cat0" }); sementesDT.Rows.Add(new object[] { 1, 0, "SubCat1-Cat0" }); sementesDT.Rows.Add(new object[] { 2, 0, "SubCat2-Cat0" }); sementesDT.Rows.Add(new object[] { 3, 1, "SubCat3-Cat1" }); sementesDT.Rows.Add(new object[] { 4, 1, "SubCat4-Cat1" }); sementesDT.Rows.Add(new object[] { 5, 1, "SubCat5-Cat1" }); sementesDT.Rows.Add(new object[] { 6, 2, "SubCat6-Cat2" }); sementesDT.Rows.Add(new object[] { 7, 2, "SubCat7-Cat2" }); sementesDT.Rows.Add(new object[] { 8, 2, "SubCat8-Cat2" }); InitializeComponent(); tipoBS = new BindingSource(); tipoBS.DataSource = tipoDT; TipoComboBoxColumn.DataSource = tipoBS; TipoComboBoxColumn.DisplayMember = "Tipo"; TipoComboBoxColumn.ValueMember = "CodTipo"; unfilteredSementesBS = new BindingSource(); DataView undv = new DataView(sementesDT); unfilteredSementesBS.DataSource = undv; EspecieComboBoxColumn.DataSource = unfilteredSementesBS; EspecieComboBoxColumn.DisplayMember = "Semente"; EspecieComboBoxColumn.ValueMember = "CodTipo"; filteredSementesBS = new BindingSource(); DataView dv = new DataView(sementesDT); filteredSementesBS.DataSource = dv; } Thank you very much for your attention, time and help and I'm looking forward to your reply. Best regards, JC Carmo.
  7. Hello everyone, I have a DataGridView in a windows form with three columns: Column1 is TipoComboBoxColumn Column2 is QuantidadeColumn Column3 is SementeComboBoxColumn I need the SementeComboBoxColumn to display values according to the value I select in the TipoComboBoxColumn. How do I go about accomplishing that? The code below works in part, BUT when I'm editing the value of SementeComboBoxColumn, the other values for the other rows in this column disappear. This is driving nuts! private void tabBAdetDataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { if (tabBAdetDataGridView.Columns[e.ColumnIndex].Name == "EspecieComboBoxColumn") { this.tabSementesTableAdapter.FillByTipo(this.sascrDataSet.tabSementes, tabBAdetDataGridView.Rows[e.RowIndex].Cells["TipoComboBoxColumn"].Value.ToString()); this.EspecieComboBoxColumn.DataSource = this.tabSementesBindingSource; this.EspecieComboBoxColumn.DisplayMember = "Semente"; } else { this.tabSementesTableAdapter.Fill(this.sascrDataSet.tabSementes); this.EspecieComboBoxColumn.DataSource = this.tabSementesBindingSource; this.EspecieComboBoxColumn.DisplayMember = "Semente"; } } Thanks in advance, JC Carmo
  8. Hello everyone, Here's the scenario: I have three windows forms (frmMain, frmClients, frmOrders). There's a button on frmClients that opens frmOrders. Now, the question is: What's the code on frmClients to define that the frmOrders' MDIParent is frmMain? Thank you very much for your time and help, JC Carmo.
  9. Hi guys, I'm trying to run a parameterized crystal report in C# (Visual Studio 2005 Professional) getting values from 3 textbox controls (windows form): cbCliente is the textbox control for the client's name (string) DataIni is the textbox control for the initial date (DateTime) DataFin is the textbox control for the final date (DateTime) The code below runs just fine, but when I try to add the DataIni and DataFin parameters, it gives an error message: private void btnFatura_Click(object sender, EventArgs e) { string selectFormula = "Mid({qryALL1.Cliente}, 1) = \"" + cbCliente.Text + "\""; crystalReportViewer1.SelectionFormula = selectFormula; } My question is: How do I add the DataIni and DataFin parameters? I've tried many ways, but they didn't work. I'm getting the synthax wrong somewhere: string selectFormula = "Mid({qryALL1.Cliente}, 1) = '" + cbCliente.Text + "' AND {qryALL1.Date} in (" + Convert.ToDateTime(DataIni.Text) + ") to (" + Convert.ToDateTime(DataFin.Text) + ")"; Thanks in advance, JC :)
  10. Hi Iceplug, thanks for the tip! :)
  11. Hi everybody, Happy Holidays! I have a datagrid with 3 columns: Column 1 is combobox Column 2 is textbox column 3 is combobox I've been trying to display values in the combobox on column 3 depending on the value selected in the combobox on column 1. What's the best approach? I've tried many different ways, but to no avail ... Thanks in advance! JC :)
  12. Hi Cags, What's the best way of dealing with this kind of issue? I've searched the MSDN Help but couldn't find any pertinent leads to solving it. Thanks a lot! Happy Holidays, JC :)
  13. Hi TripleB. I had already solved the problem with a Try/Catch statement but I do appreciate your time and help. Thanks a lot, JC :)
  14. Hi TripleB, The error message appears when I close the form that cointains the above code and also when I stop debugging the app. The error message is: Object reference not set to an instance of an object. Use the "new" keyword to create an object instance. Check to determine if the object is null before calling the method. Any ideas? Thanks a lot, JC :)
  15. Marble Eater, I don't mean to be a drag, but how exactly would you deal with this issue? I'm still learning... THis is what I just did it and worked, but when I stop the debugging process it gives an error message: private void mcMultiColumnComboBox1_SelectedIndexChanged(object sender, EventArgs e) { DataRowView myDataRowView = (DataRowView)mcMultiColumnComboBox1.SelectedItem; this.cultivarTextBox.Text = myDataRowView[2].ToString(); } Thanks, JC :)
×
×
  • Create New...