Hi
I have a problem populating my datagrid when the values passed have an apostrophie (') like this test's. Any other values work. This is my asp.net cod
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loa
'Put user code to initialize the page her
Dim s As String = Request.QueryString("id").ToString(
If Not Page.IsPostBack The
Dim conPos As SqlConnectio
Dim cmdSel As SqlDataAdapte
Dim ds As DataSe
conPos = New SqlConnection("Server = prod01\enterprise;UID=sa;PWD=xxxx;Database=POS"
cmdSel = New SqlDataAdapter("LoadOrderRegulation", conPos
cmdSel.SelectCommand.CommandType = CommandType.StoredProcedur
cmdSel.SelectCommand.Parameters.Add(New SqlParameter("@productName", SqlDbType.VarChar, 15)
cmdSel.SelectCommand.Parameters("@productName").Va lue =
ds = New DataSe
cmdSel.Fill(ds, "Oreg"
DataGrid1.DataSource = ds.Tables("Oreg").DefaultVie
DataGrid1.DataBind(
End I
End Su
This is my stored pro
create procedure LoadOrderRegulation
@productName varchar(50
a
declare @productNumber varchar(10
exec POS_GetProductNumber @productName, @productNumber OUTPU
If len(@productNumber) = 1
Set @productNumber = '0000' + @productNumbe
If len(@productNumber) =
Set @productNumber = '000' + @productNumbe
If len(@productNumber) =
Set @productNumber = '00' + @productNumbe
If len(@productNumber) =
Set @productNumber = '0' + @productNumbe
select
POS_Product_Number
POS_Store_Number
POS_Account_Number
POS_Current_Draw
POS_Proposed_Draw
POS_Average_Sale
POS_Date_Regulated
POS_Adjustmen
from pos_order_regulation where POS_Product_Number = @productNumbe
retur
I think my stored proc is expecting test''s instead of test's. How can I handle this. If I execute the stored procedure from query analyzer like this
declare @datatest varchar(20
exec LoadOrderRegulation 'test''s', @datatest OUTPU
Select @datatest
it work 2 1075
Here's how I solve a similar problem, building a SQL query with
Stringbuilder (yes, soon to be a stored procedure...):
sbldr.Append(Me.shipTo_First_Name.Replace("'", "''")) : sbldr.Append("','")
"Chris" <an*******@discussions.microsoft.com> wrote in message
news:8A**********************************@microsof t.com... Hi, I have a problem populating my datagrid when the values passed have an
apostrophie (') like this test's. Any other values work. This is my asp.net
code Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Dim s As String = Request.QueryString("id").ToString()
If Not Page.IsPostBack Then
Dim conPos As SqlConnection Dim cmdSel As SqlDataAdapter Dim ds As DataSet
conPos = New SqlConnection("Server =
prod01\enterprise;UID=sa;PWD=xxxx;Database=POS")
cmdSel = New SqlDataAdapter("LoadOrderRegulation", conPos)
cmdSel.SelectCommand.CommandType = CommandType.StoredProcedure
cmdSel.SelectCommand.Parameters.Add(New
SqlParameter("@productName", SqlDbType.VarChar, 15)) cmdSel.SelectCommand.Parameters("@productName").Va lue = s ds = New DataSet cmdSel.Fill(ds, "Oreg")
DataGrid1.DataSource = ds.Tables("Oreg").DefaultView DataGrid1.DataBind()
End If
End Sub This is my stored proc create procedure LoadOrderRegulation( @productName varchar(50) )
as
declare @productNumber varchar(10)
exec POS_GetProductNumber @productName, @productNumber OUTPUT
If len(@productNumber) = 1
Set @productNumber = '0000' + @productNumber
If len(@productNumber) = 2
Set @productNumber = '000' + @productNumber
If len(@productNumber) = 3
Set @productNumber = '00' + @productNumber
If len(@productNumber) = 4
Set @productNumber = '0' + @productNumber
select POS_Product_Number, POS_Store_Number, POS_Account_Number, POS_Current_Draw, POS_Proposed_Draw, POS_Average_Sale, POS_Date_Regulated, POS_Adjustment
from pos_order_regulation where POS_Product_Number = @productNumber return
I think my stored proc is expecting test''s instead of test's. How can I
handle this. If I execute the stored procedure from query analyzer like this
declare @datatest varchar(20)
exec LoadOrderRegulation 'test''s', @datatest OUTPUT
Select @datatest
it works
Here's how I solve a similar problem, building a SQL query with
Stringbuilder (yes, soon to be a stored procedure...):
sbldr.Append(Me.shipTo_First_Name.Replace("'", "''")) : sbldr.Append("','")
"Chris" <an*******@discussions.microsoft.com> wrote in message
news:8A**********************************@microsof t.com... Hi, I have a problem populating my datagrid when the values passed have an
apostrophie (') like this test's. Any other values work. This is my asp.net
code Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Dim s As String = Request.QueryString("id").ToString()
If Not Page.IsPostBack Then
Dim conPos As SqlConnection Dim cmdSel As SqlDataAdapter Dim ds As DataSet
conPos = New SqlConnection("Server =
prod01\enterprise;UID=sa;PWD=xxxx;Database=POS")
cmdSel = New SqlDataAdapter("LoadOrderRegulation", conPos)
cmdSel.SelectCommand.CommandType = CommandType.StoredProcedure
cmdSel.SelectCommand.Parameters.Add(New
SqlParameter("@productName", SqlDbType.VarChar, 15)) cmdSel.SelectCommand.Parameters("@productName").Va lue = s ds = New DataSet cmdSel.Fill(ds, "Oreg")
DataGrid1.DataSource = ds.Tables("Oreg").DefaultView DataGrid1.DataBind()
End If
End Sub This is my stored proc create procedure LoadOrderRegulation( @productName varchar(50) )
as
declare @productNumber varchar(10)
exec POS_GetProductNumber @productName, @productNumber OUTPUT
If len(@productNumber) = 1
Set @productNumber = '0000' + @productNumber
If len(@productNumber) = 2
Set @productNumber = '000' + @productNumber
If len(@productNumber) = 3
Set @productNumber = '00' + @productNumber
If len(@productNumber) = 4
Set @productNumber = '0' + @productNumber
select POS_Product_Number, POS_Store_Number, POS_Account_Number, POS_Current_Draw, POS_Proposed_Draw, POS_Average_Sale, POS_Date_Regulated, POS_Adjustment
from pos_order_regulation where POS_Product_Number = @productNumber return
I think my stored proc is expecting test''s instead of test's. How can I
handle this. If I execute the stored procedure from query analyzer like this
declare @datatest varchar(20)
exec LoadOrderRegulation 'test''s', @datatest OUTPUT
Select @datatest
it works This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: WertmanTheMad |
last post by:
Ok here goes, another odd SQL Question ....as always..
How do I get ...
The value of a paramater passed to say a Trigger
OR The SQL Itself
Like this , say I have a Trigger set on delete,
...
|
by: Chris |
last post by:
Hi
I have a problem populating my datagrid when the values passed have an apostrophie (') like this test's. Any other values work. This is my asp.net cod
Private Sub Page_Load(ByVal sender As...
|
by: Chris |
last post by:
Hi
I have a problem populating my datagrid when the values passed have an apostrophie (') like this test's. Any other values work. This is my asp.net cod
Private Sub Page_Load(ByVal sender As...
|
by: Chris |
last post by:
Hi
I have a problem populating my datagrid when the values passed have an apostrophie (') like this test's. Any other values work. This is my asp.net cod
Private Sub Page_Load(ByVal sender As...
|
by: Jim Langston |
last post by:
In my function/method paramater list I try to keep constant correctness.
I.E. I would use:
int Foo( const char* a, int b )
instead of
int Foo( char* a, int b )
My question reguards int b. ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |