15,997,460 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 .NET 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 Cute Girly Geek (Top 6 by date)
Cute Girly Geek
1-Sep-16 22:04pm
View
Thank you R.D. It worked.... whew!!! Thanks again! :*
Cute Girly Geek
14-Aug-16 22:44pm
View
Thank you so much 0x01AA! Your response is a gem. :)
Cute Girly Geek
11-Aug-16 23:14pm
View
Thank you Mr. Richard.. Sorry for the late reply.. its the design of my form that is... I think is at fault.. I tried everything to be done in one form. (nilesh sawardekar was right at that).. So I just created a new form for my search and it was working. Though I would really love to get an example of viewstate. Thanks again. :)
Cute Girly Geek
11-Aug-16 23:14pm
View
Thank you Mr. Richard.. Sorry for the late reply.. its the design of my form that is... I think is at fault.. I tried everything to be done in one form. (nilesh sawardekar was right at that).. So I just created a new form for my search and it was working. Though I would really love to get an example of viewstate. Thanks again. :)
Cute Girly Geek
1-Aug-16 23:35pm
View
Deleted
Hello Again,
I kinda cleaned my code a bit. I also used a viewstate.. but I still get the error.
<pre lang="vb">
Protected Sub lnkSearch_Click(sender As Object, e As EventArgs) Handles lnkSearch.Click
Dim strSearch As String
strSearch = "SELECT Fid,RealName,Department FROM tblUsers" &
" WHERE RealName LIKE '%" & txtName.Text & "%'"
Dim constring As String = "Data Source=LOCALHOST\SQLEXPRESS;Initial Catalog=dbTOD_Sql;Integrated Security=True"
Using con As New SqlConnection(constring)
Using cmd As New SqlCommand(strSearch, con)
cmd.CommandType = CommandType.Text
Using sda As New SqlDataAdapter(cmd)
Using dt As New DataTable()
sda.Fill(dt)
'Set AutoGenerateColumns False
GridView1.AutoGenerateColumns = False
'First time knowing ViewState. HOpe this works
ViewState("vsTable") = dt
'Reading the viewstate values.
Dim dt2 As DataTable = DirectCast(ViewState("vsTable"), DataTable)
GridView1.DataSource = dt2
GridView1.DataBind()
End Using
End Using
End Using
End Using
End Sub
</pre>
Cute Girly Geek
1-Aug-16 22:41pm
View
Sorry I pasted the wrong lnkSearch_Click.. It's like the BindGrid() Routine but with str = "Select * FROM tblUsers WHERE Username LIKE '%" & txtName.txt & "%'"
Thank you for your response btw, I promise to be a good girl and will study and implement parameterized query after I get all my needed functions. Will clean code afterwards. Thanks again :)
Show More