Using CommandBuilder's QuotePrefix / QuoteSuffix

Posted at : Feb/16/2007
2857 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
cxdw
Input code above below (Case Sensitive) :

ABOUT ME

Rully Yulian MF
Rully Yulian Muhammad Firmansyah | Founder & IT Trainer Native Enterprise | MCT (2008-2019) | MVP (2009-2016) | Xamarin Certified Professional | MTA | MCAD | MCPD | MOS | Bandung, West Java, Indonesia.

[Read More...]

TOP DOWNLOAD

Mapping Hak Akses User Pada MenuStrip Sampai Control Button
downloaded 6982 times

Bagaimana caranya menginstal database ketika deploying sebuah aplikasi?
downloaded 4893 times

Simple Voice Engine Application With Sound Player Class...
downloaded 4045 times

Change Group,Sort Order, Filtering By Date in Crystal Reports
downloaded 3460 times

WinForms DataGrid Paging With SqlDataAdapter
downloaded 2881 times


LINKS

CERTIFICATIONS

Xamarin Certified
MOS 2007
MCT
MCPD
MCTS
MCAD.NET
ASP.NET Brainbench

NATIVE ENTERPRISE

Native Enterprise - IT Training

FOLLOW ME

Youtube  Facebook  Instagram  LinkedIn   Twitter

RSS


NATIVE ENTERPRISE NEWS

© Copyright 2006 - 2024   Rully Yulian MF   All rights reserved.