15,907,905 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 12474994 (Top 5 by date)
Member 12474994
28-Apr-16 3:09am
View
I've already check it out but the way they bind the data is different compared to mine. I bind each column with different sql command under different sub.
for example:
Private Sub BindBpn()
Using con As New SqlConnection(ConfigurationManager.ConnectionStrings("SQLServer2005DBConnectionString").ToString())
Using cmd As New SqlCommand("SELECT * FROM LOT WHERE BASEPRODUCTNAME='" & txtbpn.Text & "'order by checkin asc")
Using sda As New SqlDataAdapter()
cmd.Connection = con
sda.SelectCommand = cmd
Dim dt As New DataTable()
sda.Fill(dt)
Dim dv As DataView = dt.DefaultView
GridView1.DataSource = dv
GridView1.DataBind()
End Using
End Using
End Using
If GridView1.Visible = False Then
GridView1.Visible = True
End If
If Button1.Visible = False Then
Button1.Visible = True
End If
End Sub
and
Private Sub Bindbt()
Using con As New SqlConnection(ConfigurationManager.ConnectionStrings("SQLServer2005DBConnectionString").ToString())
Using cmd As New SqlCommand("SELECT * FROM LOT WHERE MBTBoardNo='" & TextBox2.Text & "'order by checkin asc")
Using sda As New SqlDataAdapter()
cmd.Connection = con
sda.SelectCommand = cmd
Dim dt As New DataTable()
sda.Fill(dt)
Dim dv As DataView = dt.DefaultView
GridView1.DataSource = dv
GridView1.DataBind()
End Using
End Using
End Using
If GridView1.Visible = False Then
GridView1.Visible = True
End If
If Button1.Visible = False Then
Button1.Visible = True
End If
End Sub
Member 12474994
21-Apr-16 4:45am
View
I'm sorry .
the error shown is
An exception of type 'System.IndexOutOfRangeException' occurred in System.Data.dll but was not handled in user code
Additional information: Cannot find column MBTBoardNo.
Name Value Type
SortDir "Desc" String
sortExpression "MBTBoardNo" String
is this what you needed? I'm sorry it just I'm still new with vb
Member 12474994
21-Apr-16 4:28am
View
Deleted
public Class Contact
Inherits Page
'Dim ds As New DataSet
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
End Sub
' Protected Sub GridView1_Sorting(sender As Object, e As GridViewSortEventArgs)
' Dim GridViewSortExpression = e.SortExpression
'Dim pageIndex As Integer = GridView1.PageIndex
' GridView1.DataSource = (TryCast(GridView1.DataSource, DataTable) ,False)
' GridView1.DataBind()
' GridView1.PageIndex = pageIndex
'End Sub
Protected Sub bt_Click(sender As Object, e As EventArgs) Handles bt.Click
Try
Dim connection = New SqlConnection("Data Source=172.16.34.162;Initial Catalog=IMS_Location;Integrated Security=False;connect timeout=60;Pooling=false;User ID=cim_sa;Password=#CIM_SA2#;")
connection.Open()
Dim sql As String = ("select * from LOT_LOC_MBT where MBTBoardNo='" & TextBox2.Text & "'order by checkin asc")
Dim cmd As SqlCommand = New SqlCommand(sql, connection)
Using reader As SqlDataReader = cmd.ExecuteReader
If reader.HasRows Then
lblerror.Visible = False
connection.Dispose()
connection.Close()
Me.Bindbt()
txtbpn.Text = String.Empty
TextBox2.Text = String.Empty
TextBox3.Text = String.Empty
TextBox4.Text = String.Empty
TextBox5.Text = String.Empty
Else
connection.Dispose()
connection.Close()
lblerror.Text = "MBT Board No. Not Found !"
lblerror.Visible = True
txtbpn.Text = String.Empty
TextBox2.Text = String.Empty
TextBox3.Text = String.Empty
TextBox4.Text = String.Empty
TextBox5.Text = String.Empty
End If
End Using
Catch ex As Exception
Response.Write(ex.Message)
Response.AppendHeader("Refresh", "1;url=Summary.aspx")
End Try
End Sub
Private Sub Bindbt()
Dim conString As String = "Data Source=172.16.34.162;Initial Catalog=IMS_Location;Integrated Security=False;connect timeout=60;Pooling=false;User ID=cim_sa;Password=#CIM_SA2#;"
Using con As New SqlConnection(conString)
Using cmd As New SqlCommand("SELECT * FROM LOT_LOC_MBT WHERE MBTBoardNo= '" & TextBox2.Text & "'order by checkin asc")
Using sda As New SqlDataAdapter()
cmd.Connection = con
sda.SelectCommand = cmd
'Dim ds As New DataSet
' sda.Fill(ds, " LOT_LOC_MBT ")
Dim dt As New DataTable
'Dim dt As DataTable = (ds.Tables(" LOT_LOC_MBT "))
sda.Fill(dt)
sda.Fill(dt)
GridView1.DataSource = dt
GridView1.AllowSorting() = True
GridView1.DataBind()
End Using
End Using
End Using
If GridView1.Visible = False Then
GridView1.Visible = True
End If
If Button1.Visible = False Then
Button1.Visible = True
End If
End Sub
Protected Sub bpn_Click(sender As Object, e As EventArgs)
Try
Dim connection = New SqlConnection("Data Source=172.16.34.162;Initial Catalog=IMS_Location;Integrated Security=False;connect timeout=60;Pooling=false;User ID=cim_sa;Password=#CIM_SA2#;")
connection.Open()
Dim sql As String = ("select * from LOT_LOC_MBT where BASEPRODUCTNAME='" & txtbpn.Text & "'")
Dim cmd As SqlCommand = New SqlCommand(sql, connection)
Using reader As SqlDataReader = cmd.ExecuteReader
If reader.HasRows Then
Member 12474994
21-Apr-16 3:56am
View
already do the breakpoint .
sortedView.Sort = e.SortExpression & " " & SortDir 'error occur on this line
for the e.SortExpression..it match the column's name that can't be find which is the error that occured to me right now. I'm totally clueless right now. But stil
Thanks for the respond
Member 12474994
21-Apr-16 3:55am
View
I've tried your method but there aren't any data shown after I've tried to sort the data. the whole page is blank. Thanks for your respond