Showing sql table row by row in form textboxes
how to show sqlserver table rows as row by row in c# form textboxes using two buttons one for moving left and another one for moving right
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Jan 1, 2013, 4:47 AM EST
ahmed fahd57 reputationPosted Jan 1, 2013, 5:52 AM EST
i tried to use which i want of it
but i of got this error
Child list for field table name cannot be created.
could you help me in that or give me the specific part of that long code cause im not professional
Satyapriya NayakRank #47 · 31.5K reputationPosted Jan 1, 2013, 7:01 AM EST
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.OleDb;
namespace Insert_update_delete_navigate
{
public partial class Form1 : Form
{
string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["dsn"];
OleDbCommand com;
OleDbDataAdapter oledbda;
string str;
DataSet ds;
BindingManagerBase bm;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection(ConnectionString);
con.Open();
str = "select * from student";
com = new OleDbCommand(str, con);
oledbda = new OleDbDataAdapter(com);
ds = new DataSet();
oledbda.Fill(ds, "student");
textBox1.DataBindings.Add("Text", ds, "student.id");
textBox2.DataBindings.Add("Text", ds, "student.name");
bm = this.BindingContext[ds, "student"];
con.Close();
}
private void btn_next_Click(object sender, EventArgs e)
{
bm.Position += 1;
}
private void btn_previous_Click(object sender, EventArgs e)
{
bm.Position -= 1;
}
}
}
ahmed fahd57 reputationPosted Jan 1, 2013, 8:37 AM EST
but the line
bm = this.BindingContext[ds, "student"];
gives me the error of => Child list for field 'table name' cannot be created.
ahmed fahd57 reputationPosted Jan 1, 2013, 8:37 AM EST
but the line
bm = this.BindingContext[ds, "student"];
gives me the error of => Child list for field 'table name' cannot be created.