TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
t v
NA
5
0
C# + sql
May 31 2007 10:04 AM
hello, i want to fill a grid with this code, without the WHERE condition my code works fine, but when i try to filter on username, it fails.
I made a Session Username and this is my code:
public
ICollection
<
Aanvraag
> GetAllAanvragen()
{
List
<
Aanvraag
> result =
new
List
<
Aanvraag
>();
using
(
SqlConnection
connection =
new
SqlConnection
(_connectionString))
using
(
SqlCommand
command =
new
SqlCommand
())
{
command.CommandText =
"SELECT VID, State, Begindatum, Einddatum, WorkflowInstanceID, Opmerking, Type, Username FROM tblVerlofaanvraag
WHERE Username = 'Session[username].ToString()'"
;
connection.Open();
command.Connection = connection;
using
(
SqlDataReader
reader = command.ExecuteReader())
{
while
(reader.Read())
{
result.Add(
Aanvraag
.CreateFromDataReader(reader));
}
}
}
return
result;
}
Reply
Answers (
3
)
Novice Problem
Can I parse an int out of the first character of a string?