M
Mimosa Arts
Guest
Ive got a simple POC VB.NET app that Im trying to convert to C#. Im not fluent in C# and dont have a clue whats going on here.
My converted app is below but I cant compile due to three errors:
one "Non-invocable member System.Data.Dataset.tables cannot be used like a method.
two "Non-invocable member System.Data.Dataset.table.columns cannot be used like a method.
Whats wrong with this conversion?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlServerCe;
namespace C_Sharp_POC_app
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void // ERROR: Handles clauses are not supported in C#
Form1_Load(object sender, System.EventArgs e)
{
LoadSnippetList();
}
public void LoadSnippetList()
{
DataSet ds = new DataSet();
DataTable dt = default(DataTable);
string DBFullPath = "";
string rootpath = null;
string password = null;
SqlCeConnection conn = default(SqlCeConnection);
rootpath = "C:\\SDF Data\\MyFart.sdf";
password = "ou812";
DBFullPath = "Data Source=" + rootpath + ";Password=" + password;
conn = new SqlCeConnection();
conn.ConnectionString = DBFullPath;
SqlCeDataAdapter ceda = new SqlCeDataAdapter("SELECT IdCodeSnippet,[Name]FROM Snippets ORDER by [Name]", conn);
conn.Open();
ceda.Fill(ds, "SNames");
dt = ds.Tables("SNames");
//combo box populated on form load
this.cboSnippetNames.DisplayMember = dt.Columns(1).ToString;
this.cboSnippetNames.ValueMember = dt.Columns(0).ToString;
this.cboSnippetNames.DataSource = dt;
}
}
}
Continue reading...
My converted app is below but I cant compile due to three errors:
one "Non-invocable member System.Data.Dataset.tables cannot be used like a method.
two "Non-invocable member System.Data.Dataset.table.columns cannot be used like a method.
Whats wrong with this conversion?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlServerCe;
namespace C_Sharp_POC_app
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void // ERROR: Handles clauses are not supported in C#
Form1_Load(object sender, System.EventArgs e)
{
LoadSnippetList();
}
public void LoadSnippetList()
{
DataSet ds = new DataSet();
DataTable dt = default(DataTable);
string DBFullPath = "";
string rootpath = null;
string password = null;
SqlCeConnection conn = default(SqlCeConnection);
rootpath = "C:\\SDF Data\\MyFart.sdf";
password = "ou812";
DBFullPath = "Data Source=" + rootpath + ";Password=" + password;
conn = new SqlCeConnection();
conn.ConnectionString = DBFullPath;
SqlCeDataAdapter ceda = new SqlCeDataAdapter("SELECT IdCodeSnippet,[Name]FROM Snippets ORDER by [Name]", conn);
conn.Open();
ceda.Fill(ds, "SNames");
dt = ds.Tables("SNames");
//combo box populated on form load
this.cboSnippetNames.DisplayMember = dt.Columns(1).ToString;
this.cboSnippetNames.ValueMember = dt.Columns(0).ToString;
this.cboSnippetNames.DataSource = dt;
}
}
}
Continue reading...