toopak
شنبه 26 مرداد 1387, 15:16 عصر
خسته نباشید
آقا یه سوال داشتم از خدمتتون
من یه سرچ نوشتم که اطلاعات مطابق با جستجو رو توی datagrid نمایش بده
کدش اینه
Dim ds As New DataSet
Dim inssql As String
Dim cmdsql As New OleDbCommand
If rname.Checked = True Then
inssql = "SELECT * FROM tbaccounts WHERE accname='" & txtname.Text & "' " '& " txtname.Text &'"
ElseIf rtell.Checked = True Then
inssql = "SELECT * FROM tbaccounts WHERE acctell= " & txttell.Text
ElseIf rid.Checked = True Then
inssql = "SELECT * FROM tbaccounts WHERE accname= " & txtname.Text
End If
con.Open()
cmdsql.Connection = con
cmdsql.CommandText = inssql
Dim da As New OleDbDataAdapter(inssql, con)
da.Fill(ds, "tbaccounts")
DataGridView1.DataBindings.Add(New Binding("datasource", ds, "tbaccounts"))
DataGridView1.Visible = True
con.Close()
برای اولین بار درست کار میکنه اما بار دوم که دکمه جستجو رو میزنم
دیباگر برنامه برای اون قسمت که تو کد قرمز کردم
این ارور رو میده
This causes two bindings in the collection to bind to the same property.
Parameter name: binding
مشکل کجاس؟:متفکر:
راه حل چیه؟
ممنون:خجالت:
آقا یه سوال داشتم از خدمتتون
من یه سرچ نوشتم که اطلاعات مطابق با جستجو رو توی datagrid نمایش بده
کدش اینه
Dim ds As New DataSet
Dim inssql As String
Dim cmdsql As New OleDbCommand
If rname.Checked = True Then
inssql = "SELECT * FROM tbaccounts WHERE accname='" & txtname.Text & "' " '& " txtname.Text &'"
ElseIf rtell.Checked = True Then
inssql = "SELECT * FROM tbaccounts WHERE acctell= " & txttell.Text
ElseIf rid.Checked = True Then
inssql = "SELECT * FROM tbaccounts WHERE accname= " & txtname.Text
End If
con.Open()
cmdsql.Connection = con
cmdsql.CommandText = inssql
Dim da As New OleDbDataAdapter(inssql, con)
da.Fill(ds, "tbaccounts")
DataGridView1.DataBindings.Add(New Binding("datasource", ds, "tbaccounts"))
DataGridView1.Visible = True
con.Close()
برای اولین بار درست کار میکنه اما بار دوم که دکمه جستجو رو میزنم
دیباگر برنامه برای اون قسمت که تو کد قرمز کردم
این ارور رو میده
This causes two bindings in the collection to bind to the same property.
Parameter name: binding
مشکل کجاس؟:متفکر:
راه حل چیه؟
ممنون:خجالت: