Could use some help please.
-
Ok ill start by saying I am new to c# what i am trying to do is basicly access a ultralite db it has a table named Names(name,chan,freq,mpchan) I want to populate a combox with name field than have 3 text fields populate with the appropriate data for the name selection. Here is what i got so far
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Text; using System.Windows.Forms; using iAnywhere.Data.UltraLite; using System.Collections; namespace ChannMap { public partial class Form1 : Form { private string strChan; private string strFreq; private string strName; private string strMapChan; private string strTemp; private string [] strArraylist=new string [1000]; static int i = 0; //index for strArraylist private ULConnection ConnUL = new ULConnection(); private ULDataAdapter myDataAdapter = new ULDataAdapter(); private void Form1_Load(object sender, System.EventArgs e) { fnGetConnectedToDatabase(); } public Form1() { InitializeComponent(); } private void fnGetConnectedToDatabase() { try { String dbf = "\\Program Files\\ChannMap\\ChannMap.udb"; if (System.IO.File.Exists(dbf)) { ConnUL.ConnectionString = "dbf=" + dbf + ";cache_size=1M"; if (ConnUL.State != ConnectionState.Open) { ConnUL.Open(); } ConnUL.DatabaseID = 1000; } else { MessageBox.Show("Database is not available", "Error"); Application.Exit(); } } catch (System.Exception t) { MessageBox.Show(t.Message, "Connection failed"); return; } string sqlStr = "SELECT * FROM Names;"; myDataAdapter = new ULDataAdapter(sqlStr,ConnUL); //Instantiate a DataSet DataSet myDataset = new DataSet(); // Populate the data table "Names" myDataset.Clear(); myDataAdapter.Fill(myDataset,"Names"); foreach (DataRow myRow in myDataset.Tables["Names"].Rows) { strChan =(string) myRow["chan"];
-
Ok ill start by saying I am new to c# what i am trying to do is basicly access a ultralite db it has a table named Names(name,chan,freq,mpchan) I want to populate a combox with name field than have 3 text fields populate with the appropriate data for the name selection. Here is what i got so far
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Text; using System.Windows.Forms; using iAnywhere.Data.UltraLite; using System.Collections; namespace ChannMap { public partial class Form1 : Form { private string strChan; private string strFreq; private string strName; private string strMapChan; private string strTemp; private string [] strArraylist=new string [1000]; static int i = 0; //index for strArraylist private ULConnection ConnUL = new ULConnection(); private ULDataAdapter myDataAdapter = new ULDataAdapter(); private void Form1_Load(object sender, System.EventArgs e) { fnGetConnectedToDatabase(); } public Form1() { InitializeComponent(); } private void fnGetConnectedToDatabase() { try { String dbf = "\\Program Files\\ChannMap\\ChannMap.udb"; if (System.IO.File.Exists(dbf)) { ConnUL.ConnectionString = "dbf=" + dbf + ";cache_size=1M"; if (ConnUL.State != ConnectionState.Open) { ConnUL.Open(); } ConnUL.DatabaseID = 1000; } else { MessageBox.Show("Database is not available", "Error"); Application.Exit(); } } catch (System.Exception t) { MessageBox.Show(t.Message, "Connection failed"); return; } string sqlStr = "SELECT * FROM Names;"; myDataAdapter = new ULDataAdapter(sqlStr,ConnUL); //Instantiate a DataSet DataSet myDataset = new DataSet(); // Populate the data table "Names" myDataset.Clear(); myDataAdapter.Fill(myDataset,"Names"); foreach (DataRow myRow in myDataset.Tables["Names"].Rows) { strChan =(string) myRow["chan"];
I did't read the whole code, but I can see a problem in the way you use the String.Split method.
splitstr = strArraylist[this.comboChanName.SelectedIndex].Split(delimstr, 4);
This won't compile because it is not a valid overload. You should use
delimeter
instead ofdelimstr
as the first parameter... See the complete list of String.Split overloads. -
I did't read the whole code, but I can see a problem in the way you use the String.Split method.
splitstr = strArraylist[this.comboChanName.SelectedIndex].Split(delimstr, 4);
This won't compile because it is not a valid overload. You should use
delimeter
instead ofdelimstr
as the first parameter... See the complete list of String.Split overloads. -
Ok. I will try to ignore the fact that you provided way too much code that seems very cryptic and unreadable, while only about 10 lines are related to the error... I will ignore the fact that most of the infrotmation you provided with your code is absolutely useless and irrelevant. I will ignore the fact that the title of your first post is the second worst possible title (the first one being "PLZ HELP URGNT"). And I will also try to ignore the fact that your last post didn't contain that mysterious word starting with "tha" and ending with "nks"... If my previous advice didn't help, there is not much more I can do for you. The best help I can give you is: Read the compiler error carefully. Locate the problem in your code. Check everything on that line, see what parameters are required for each method... And then make sure that the parameters you are passing match the required type. With intellisense and all the support provided by Visual Studio (or whatever tool you use) it should not take more than 23.7865039 seconds to locate and fix such a simple error like a type mismatch... even if you are a beginner!