Chủ đề: Dùng parameter trong SQL Command
-
02-10-2013, 07:12 PM #1Junior Member
- Ngày tham gia
- Sep 2015
- Đang ở
- 89 Tam Trinh - Hoàng Mai - Hà Nội
- Bài viết
- 0
Dùng parameter trong SQL Command
Mình đang học lập trình CSDL bằng C# được mấy tháng nay. Lúc làm sqlcomamnd, giáo viên yêu cầu sử dụng parameter và bảo tự tìm tài liệu tham khảo, mình tìm google nhưng toàn tiếng Anh, bạn nào hướng dẫn mình hoặc có tại liệu cho mình với, mình xin cám ơn.!
View more random threads:
- Cần giúp đỡ thư viện OpenCVDotNet!
- Upload file qua CGI
- Tabpage control
- Lỗi chỉ cho phép đọc database khi auto attach database
- Tự động chèn thông tin từ textbox vào tất cả các dòng của datagridview
- Hàm kiểm tra kết nối tới SQL Server
- Cần giúp đỡ Microsoft VisuaStdudio 2010
- steganography in audio
- Giúp em lớp string trong c# với
- Cần giúp về ContextMenu thông qua thư viện Telerik...
-
02-10-2013, 07:22 PM #2Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
Thử xem giúp được bạn không.
http:/huttrung.wordpress.com/2013/...ng-sqlcommand/
-
08-10-2013, 09:02 AM #3Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
public void InsertItem( Items item)
{
try
{
this.OpenConect();//Connect tới cơ sở dữ liệu, t
SqlCommand cmd = new SqlCommand();
cmd = Connection.CreateCommand();
cmd.CommandType = CommandType.Text;
string sqlInsert = "INSERT Items (ItemId, FormId, ItemName, Quantity,SeriItem, Note) VALUES (@pItemId, @pFormId, @pItemName, @pQuantity, @pSeriItem, @pNote)";
cmd.CommandText = sqlInsert;
cmd.Parameters.Add("@pItemId", SqlDbType.BigInt);
cmd.Parameters.Add("@pFormId", SqlDbType.BigInt);
cmd.Parameters.Add("@pItemName", SqlDbType.NVarChar, 50);
cmd.Parameters.Add("@pQuantity", SqlDbType.Int);
cmd.Parameters.Add("@pSeriItem", SqlDbType.NVarChar, 50);
cmd.Parameters.Add("@pNote", SqlDbType.NVarChar, 300);
cmd.Prepare();
cmd.Parameters["@pItemId"].Value = item.ItemId;
cmd.Parameters["@pFormId"].Value = item.FormID;
cmd.Parameters["@pItemName"].Value = item.ItemName;
cmd.Parameters["@pQuantity"].Value = item.Quantity;
cmd.Parameters["@pSeriItem"].Value = item.SeriItem;
cmd.Parameters["@pNote"].Value = item.Note;
//cmd.Connection = this.Connection;
cmd.ExecuteNonQuery();
}catch( SqlException ex)
{
}
finally
{
this.CloseConnect();
}
}
-
09-10-2013, 03:58 PM #4Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
Cho bạn cái này mình tải được về trên mạng:
http://www.mediafire.com/?2yxmon718231fgv
Tải về sài thử đi, có cả code trên sql + trên C#
-
15-05-2016, 10:19 AM #5Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
Gửi bởi haucanpop6590
[IMG]images/smilies/17.gif[/IMG] [IMG]images/smilies/17.gif[/IMG] [IMG]images/smilies/17.gif[/IMG] [IMG]images/smilies/17.gif[/IMG] [IMG]images/smilies/17.gif[/IMG] [IMG]images/smilies/17.gif[/IMG] [IMG]images/smilies/17.gif[/IMG] [IMG]images/smilies/17.gif[/IMG] [IMG]images/smilies/17.gif[/IMG] [IMG]images/smilies/laughing.gif[/IMG] [IMG]images/smilies/laughing.gif[/IMG] [IMG]images/smilies/laughing.gif[/IMG] [IMG]images/smilies/laughing.gif[/IMG] [IMG]images/smilies/laughing.gif[/IMG] [IMG]images/smilies/laughing.gif[/IMG] [IMG]images/smilies/laughing.gif[/IMG][IMG]images/smilies/2.gif[/IMG] [IMG]images/smilies/2.gif[/IMG] [IMG]images/smilies/2.gif[/IMG] [IMG]images/smilies/2.gif[/IMG] [IMG]images/smilies/2.gif[/IMG]
Pallet nhựa Lâm Đồng giải pháp hoàn hảo cho nhà kho Pallet nhựa Lâm Đồng là một giải pháp đa năng và hiệu quả trong việc vận chuyển và lưu trữ hàng hóa. Trong đó, pallet nhựa Lâm Đồng không chỉ đáp...
Pallet nhựa Lâm Đồng giải pháp...