Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
How to write unittest for database classes?
darma teja
7y
181
1
Reply
public
bool
insertCustomer(Customer newCustomer)
{
bool
inserted =
false
;
SqlCommand cmd=
new
SqlCommand();
cmd.CommandText=
"insert into Customer (name, firstname, address) values (@name, @firstname, @address)"
;
cmd.Parameters.add(
new
SqlParameter(
"@name"
,Customer.name));
cmd.Parameters.add(
new
SqlParameter(
"@firstname"
,Customer.firstname));
cmd.Parameters.add(
new
SqlParameter(
"@address"
,Customer.address));
// executes command here and it returns new ID isnsterted= true;
return
inserted ;
}
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
File Exists using url
How to find earliest and latest date from list of dates?