Using CommandBuilder's QuotePrefix / QuoteSuffix

Created at : Feb/16/2007  
667 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)
URL (optional)
Example : http://www.yulianmf.com  
Comment

bycx
Input code above below (Case Sensitif) :
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 2231 times  
Change Group,Sort Order, Filtering By Date in Crystal Reports : Downloaded 2192 times  
Simple Voice Engine Application With Sound Player Class... : Downloaded 1523 times  
DataGridView Grouping : Downloaded 1243 times  
WinForms DataGrid Paging With SqlDataAdapter : Downloaded 1232 times  
Article Category 
Links 
Award 
Certifications 
MOS 2007
MCAS
MCT
MCPD
MCTS
MCAD.NET
ASP.NET Brainbench
Native Enterprise - IT Training 
Native Enterprise Facebook Group 
My Facebook 
My LinkedIn 
Syndication (RSS 2.0) 
Powered By 
Native Enterprise News