Using CommandBuilder's QuotePrefix / QuoteSuffix

VB - ADO.NET , Posted at : Feb/16/2007  
1286 Views   0 Comments

Pernah mengalami gagal update pada tabel yang mempunyai spasi di nama tabelnya? misalnya tabel 'Order Details' di Northwind. Hal tersebut dapat terjadi kalau kita menggunakan Untyped DataSet dan CommandBuilder sebagai objek yang digunakan untuk generate Command-command secara otomatis ketika runtime. Tetapi kalau kita menggunakan Typed DataSet hal tersebut tidak terjadi. Ternyata solusinya simple :) tinggal atur properti QuotePrefix dan QuoteSuffix dari commandbuilder tsb seperti di contohkan dibawah ini :

   1:      Dim da As New SqlDataAdapter( _
   2:      "Select * From [Order Details]", "database=northwind;" & _
   3:      "Integrated Security=True")
   4:   
   5:      Dim ds As DataSet
   6:      Dim cb As SqlCommandBuilder
   7:   
   8:      Private Sub SetQuote()
   9:          ds = New DataSet
  10:          da.Fill(ds, "orderdetails")
  11:          cb = New SqlCommandBuilder(da)
  12:          cb.QuotePrefix = "["
  13:          cb.QuoteSuffix = "]"
  14:      End Sub

[Comments]

[Write your comment]
Name (required)
Email (required-will not published)
 
Comment

pfog
Input code above below (Case Sensitive) :
About Me 
Rully Yulian MF
My Name is Rully Yulian Muhammad Firmansyah. I am an IT Trainer, IT Consultant and Application Developer spesializing in Microsoft .NET technology and SQL Server database. I live in Bandung, Indonesia. My hobby is to play Guitar. [Read More...]
Top Download 
Bagaimana caranya menginstal database ketika deploying sebuah aplikasi? : Downloaded 3175 times  
Change Group,Sort Order, Filtering By Date in Crystal Reports : Downloaded 2592 times  
Mapping Hak Akses User Pada MenuStrip Sampai Control Button : Downloaded 2180 times  
Simple Voice Engine Application With Sound Player Class... : Downloaded 2127 times  
WinForms DataGrid Paging With SqlDataAdapter : Downloaded 1806 times  
Article Category 
Links 
Award 
Certifications 
MOS 2007
MCAS
MCT
MCPD
MCTS
MCAD.NET
ASP.NET Brainbench
Native Enterprise 
Follow Me 
Facebook   LinkedIn   Twitter
Syndication 
Hosted By 
Native Enterprise News