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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
ahmed fahdPosted Jan 1, 2013, 1:37 PM
but the line
bm = this.BindingContext[ds, "student"];
gives me the error of => Child list for field 'table name' cannot be created.
ahmed fahdPosted Jan 1, 2013, 1:37 PM
but the line
bm = this.BindingContext[ds, "student"];
gives me the error of => Child list for field 'table name' cannot be created.
Satyapriya NayakPosted Jan 1, 2013, 12:01 PM
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 fahdPosted Jan 1, 2013, 10:52 AM
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 NayakPosted Jan 1, 2013, 9:47 AM