k1csharpdeveloper
سه شنبه 06 مهر 1389, 18:02 عصر
من برای کار با database در پروژم و زیبایی کار از یکسری buttonهای زیبا استفاده کردم و میخوام هر کدوم از button هام این اعمال رو انجام بدن:
add
save
edit
delete
move nextآخرین رکورد
move last اولین رکورد
next record
last record
اگه پروژه ای دارید که اینکارارو انجام میده روی database برام upload کنید
sepide1
چهارشنبه 07 مهر 1389, 09:40 صبح
اول باید اطلاعات بانک را در فرم لود کنید
DataSet ds;
SqlDataAdapter da;
SqlConnection con;
con=new SqlConnection("server=(local);database=bank1;user id=sepide1;password=123");
con.Open();
ds=new DataSet();
da=new SqlDataAdapter("select * from mes",con);
da.Fill(ds,"mes");
con.Close();
textBox2.DataBindings.Add("text",ds.Tables["mes"],"code");
textBox3.DataBindings.Add("text",ds.Tables["mes"],"name");
textBox4.DataBindings.Add("text",ds.Tables["mes"],"family");
بعد داخل باتن next
int m = BindingContext[ds.Tables["mes"]].Position;
if (m != BindingContext[ds.Tables["mes"]].Count - 1)
{
BindingContext[ds.Tables["mes"]].Position += 1;
برای Back
int m = BindingContext[ds.Tables["mes"]].Position;
if (m > 0)
BindingContext[ds.Tables["mes"]].Position -= 1;
برای First
BindingContext[ds.Tables["mes"]].Position = 0;
برای End
BindingContext[ds.Tables["mes"]].Position = BindingContext[ds.Tables["mes"]].Count - 1;
بقیه اش را هم فعلا حوصله ندارم بگم اما اگر باتن هایت را بزاری ببینم اگر نداشتم شون و ارزش داشتند بقیه اش را هم سریع برات می زارم
vBulletin® v4.2.5, Copyright ©2000-1403, Jelsoft Enterprises Ltd.