Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

How to replace 2 single quotes with 1 in Datagrid bind

  Asked By: Kuhaylah    Date: Sep 09    Category: Asp.net    Views: 1365
  

I can save a single quote to an Access table:


sb.Append("', '")
sb.Append(Replace(Me.txtName.Text, "'", "''"))
sb.Append("', '")

But . . . . I can't get it back out and make it single for display in
a Datagrid. Not sure where or how and I've tried everything. The
Replace Function only works in VB.NET code or SQL Server Transact-
SQL, not Access SQL:

Dim strSQL As String = "SELECT Style, StyleWebPage,
[Name], Ages, Recurring, Cost, [Begin] & '--' & [End] As Times,
Address, URL, Contact, Comments FROM tblDances ORDER BY Style ASC"

Dim myCommand As New OleDbCommand(strSQL,
myConnection)
myCommand.Connection.Open()
Dim myDataReader As OleDbDataReader =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)

myDataGrid.DataSource = myDataReader
myDataGrid.DataBind()
myConnection.Close()

End Sub

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on How to replace 2 single quotes with 1 in Datagrid bind Or get search suggestion and latest updates.




Tagged: