با سلام
یک سوال داشتم چگونه لیست باکس بشه سیو کرد در پایگاه داده اکسس
مثال برنامه میخواهم اگر دکه ثبت زدم لیست باکس سیو کنه در اکسس
Printable View
با سلام
یک سوال داشتم چگونه لیست باکس بشه سیو کرد در پایگاه داده اکسس
مثال برنامه میخواهم اگر دکه ثبت زدم لیست باکس سیو کنه در اکسس
خیلی راخت میتونی این کارو انجام بدی
با استفاده از یه حلقه
جستجو کن توی سایت به نتیجه نرسیدی
برات سورسو میزارم
اگر بزاری ممنون میشم پدرم در امده
میخوام اگر 5 فیلد داریم یک دانه لیست باکس سیو شود یعنی تعداد بیشتر
ممنون میشم سورس بزاری
Imports System.DataImports System.Data.OleDb
Public Class Frm_Save_Data
Dim strcon As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & My.Application.Info.DirectoryPath & "\Data acces\school.accdb"
Dim con As OleDbConnection
Dim stroled As String = ""
Dim stroledsave As String = ""
Dim da As OleDbDataAdapter
Dim ds As New DataSet
Dim com As OleDbCommand
Private Sub Load_Bank()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
ds.Reset()
con = New OleDbConnection(strcon)
con.Open()
stroled = "SELECT ID, Fname, Lname, Dname, jensiat, Melicode, Birdate, Birloc, Edu, Telham, Telman, Adres FROM Tb_Student WHERE (Melicode = '" & TextBox3.Text & "')"
da = New OleDbDataAdapter(stroled, con)
da.Fill(ds, "Tb_Student")
con.Close()
stroledsave = "INSERT INTO Tb_Student (Fname, Lname, Dname, jensiat, Melicode, Birdate, Birloc, Edu, Telham, Telman, Adres) VALUES (@Fname, @Lname, @Dname, @jensiat, @Melicode, @Birdate, @Birloc, @Edu, @Telham, @Telman, @Adres)"
Me.BindingContext(ds, "Tb_Student").AddNew()
con.Open()
com = New OleDbCommand(stroledsave, con)
com.Parameters.Add("@Fname", OleDbType.WChar, 20).Value = TextBox1.Text
com.Parameters.Add("@Lname", OleDbType.WChar, 30).Value = TextBox2.Text
com.Parameters.Add("@Dname", OleDbType.WChar, 20).Value = TextBox7.Text
com.Parameters.Add("@jensiat", OleDbType.WChar, 4).Value = ComboBox1.Text
com.Parameters.Add("@Melicode", OleDbType.WChar, 10).Value = TextBox3.Text
com.Parameters.Add("@Birdate", OleDbType.WChar, 10).Value = MaskedTextBox1.Text
com.Parameters.Add("@Birloc", OleDbType.WChar, 25).Value = TextBox4.Text
com.Parameters.Add("@Edu", OleDbType.WChar, 10).Value = ComboBox2.Text
com.Parameters.Add("@Telham", OleDbType.WChar, 11).Value = TextBox5.Text
com.Parameters.Add("@Telman", OleDbType.WChar, 11).Value = TextBox6.Text
com.Parameters.Add("@Adres", OleDbType.WChar, 150).Value = RichTextBox1.Text
com.ExecuteNonQuery()
con.Close()
Call new_item()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
ds.Reset()
con = New OleDbConnection(strcon)
con.Open()
stroled = "SELECT ID, Fname, Lname, Dname, jensiat, Melicode, Birdate, Birloc, Edu, Telham, Telman, Adres FROM Tb_Student WHERE (Melicode = '" & TextBox3.Text & "')"
da = New OleDbDataAdapter(stroled, con)
da.Fill(ds, "Tb_Student")
con.Close()
stroledsave = "INSERT INTO Tb_Student (Fname, Lname, Dname, Jensiat, Melicode, Birdate, Birloc, Edu, Telham, Telman, Adres) VALUES ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & ComboBox1.Text & "','" & TextBox4.Text & "','" & MaskedTextBox1.Text & "','" & TextBox5.Text & "','" & ComboBox2.Text & "','" & TextBox6.Text & "','" & TextBox7.Text & "','" & RichTextBox1.Text & "')"
Me.BindingContext(ds, "Tb_Student").AddNew()
con.Open()
com = New OleDbCommand(stroledsave, con)
com.ExecuteNonQuery()
con.Close()
Call new_item()
End Sub
Private Sub new_item()
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
TextBox6.Clear()
TextBox7.Clear()
ComboBox1.SelectedIndex = -1
ComboBox2.SelectedIndex = -1
MaskedTextBox1.Clear()
TextBox1.Focus()
RichTextBox1.Clear()
End Sub
Private Sub Frm_Save_Data_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
End Class
میخواهم جای یک آیتم مثلا richtextbox
list box بزارم داده تو اکسس سیو کنه
لطفا تغییرات اکسس بگید
سوال عوض میکنم چگونه یک فایل excel در دیتا بیس ذخیره و فراخونی کنیم البته در بانک اطلاعاتی ممنون میشم با کد بزارید
با سلام
به جای این همه دردسر از همون فایل Exel برای دیتابیستون استفاده کنید .
اگرم حتما باید اکسس باشه که باید دونه دونه فیلد های اکسس رو فراخونی کنید بریزید تو اکسس که کداش تو سایت موجود هست .
با تشکر
با سلام
عجیبه من که نمیدونم شما چطور سرچ می کنید :|
https://barnamenevis.org/showthread.p...A9%D8%B3%D8%B3
با تشکر