Could anyone pls guide me what is wrong with my Update Command
Dim signbyte As Byte()
signbyte = GetByteArray() ' i create this function to return
ByteArray
Try
Dim cmd As New SqlCeCommand
cmd.Connection = myConnection
' Someone give me the following insert statement....th is ?
parameter is working,
'but I modify to update statement with @ or ?, both not
working....
'cmd.CommandTex t = "insert into test (picture) values (?)"
cmd.CommandText = "UPDATE bm00ts0001 SET imgarray = ? WHERE tid
= '" & vartid & "'"
Dim param As SqlCeParameter = cmd.Parameters. Add("imgarray",
SqlDbType.Image )
param.Value = signbyte
myConnection.Op en()
cmd.ExecuteNonQ uery()
myConnection.Cl ose()
Catch sqex As SqlCeException
MessageBox.Show (sqex.ToString( ), "DB operation failed")
Catch er As Exception
MessageBox.Show (er.ToString)
End Try 3 5845
A_PK wrote: Could anyone pls guide me what is wrong with my Update Command
Dim signbyte As Byte() signbyte = GetByteArray() ' i create this function to return ByteArray
Try Dim cmd As New SqlCeCommand cmd.Connection = myConnection
' Someone give me the following insert statement....th is
? parameter is working, 'but I modify to update statement with @ or ?, both not working.... 'cmd.CommandTex t = "insert into test (picture) values
(?)" cmd.CommandText = "UPDATE bm00ts0001 SET imgarray = ?
WHERE tid = '" & vartid & "'" Dim param As SqlCeParameter =
cmd.Parameters. Add("imgarray", SqlDbType.Image ) param.Value = signbyte myConnection.Op en() cmd.ExecuteNonQ uery() myConnection.Cl ose()
Catch sqex As SqlCeException MessageBox.Show (sqex.ToString( ), "DB operation failed") Catch er As Exception MessageBox.Show (er.ToString) End Try
I've always been told that the ? syntax for parameters is an ODBC
thing; when using a direct SQL connection you should use the @name
parameter style. Try the following changes:
Change
cmd.CommandText = "UPDATE bm00ts0001 SET imgarray = ? WHERE tid = '" &
vartid & "'"
To
cmd.CommandText = "UPDATE bm00ts0001 SET imgarray = @imgarray WHERE tid
= '" & vartid & "'"
Change
Dim param As SqlCeParameter = cmd.Parameters. Add("imgarray",
SqlDbType.Image )
To
Dim param As SqlCeParameter = cmd.Parameters. Add("@imgarray" ,
SqlDbType.Image )
Making these changes meant this code worked for me on a normal (not CE)
SQL Server.
--
Larry Lard
Replies to group please
Hi ....I tried the following code u gave me...i am expericing Token Line
Error ...what the problem could be ?
"Larry Lard" <la*******@hotm ail.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. . A_PK wrote: Could anyone pls guide me what is wrong with my Update Command
Dim signbyte As Byte() signbyte = GetByteArray() ' i create this function to return ByteArray
Try Dim cmd As New SqlCeCommand cmd.Connection = myConnection
' Someone give me the following insert statement....th is ? parameter is working, 'but I modify to update statement with @ or ?, both not working.... 'cmd.CommandTex t = "insert into test (picture) values (?)" cmd.CommandText = "UPDATE bm00ts0001 SET imgarray = ?
WHERE tid = '" & vartid & "'" Dim param As SqlCeParameter = cmd.Parameters. Add("imgarray", SqlDbType.Image ) param.Value = signbyte myConnection.Op en() cmd.ExecuteNonQ uery() myConnection.Cl ose()
Catch sqex As SqlCeException MessageBox.Show (sqex.ToString( ), "DB operation failed") Catch er As Exception MessageBox.Show (er.ToString) End Try
I've always been told that the ? syntax for parameters is an ODBC thing; when using a direct SQL connection you should use the @name parameter style. Try the following changes:
Change cmd.CommandText = "UPDATE bm00ts0001 SET imgarray = ? WHERE tid = '" & vartid & "'" To cmd.CommandText = "UPDATE bm00ts0001 SET imgarray = @imgarray WHERE tid = '" & vartid & "'"
Change Dim param As SqlCeParameter = cmd.Parameters. Add("imgarray", SqlDbType.Image ) To Dim param As SqlCeParameter = cmd.Parameters. Add("@imgarray" , SqlDbType.Image )
Making these changes meant this code worked for me on a normal (not CE) SQL Server.
-- Larry Lard Replies to group please
What's your exact error message?
A_PK wrote: Hi ....I tried the following code u gave me...i am expericing Token
Line Error ...what the problem could be ?
"Larry Lard" <la*******@hotm ail.com> wrote in message news:11******** **************@ z14g2000cwz.goo glegroups.com.. . A_PK wrote: Could anyone pls guide me what is wrong with my Update Command
Dim signbyte As Byte() signbyte = GetByteArray() ' i create this function to
return ByteArray
Try Dim cmd As New SqlCeCommand cmd.Connection = myConnection
' Someone give me the following insert
statement....th is ? parameter is working, 'but I modify to update statement with @ or ?, both
not working.... 'cmd.CommandTex t = "insert into test (picture) values (?)" cmd.CommandText = "UPDATE bm00ts0001 SET imgarray = ?
WHERE tid = '" & vartid & "'" Dim param As SqlCeParameter = cmd.Parameters. Add("imgarray", SqlDbType.Image ) param.Value = signbyte myConnection.Op en() cmd.ExecuteNonQ uery() myConnection.Cl ose()
Catch sqex As SqlCeException MessageBox.Show (sqex.ToString( ), "DB operation
failed") Catch er As Exception MessageBox.Show (er.ToString) End Try
I've always been told that the ? syntax for parameters is an ODBC thing; when using a direct SQL connection you should use the @name parameter style. Try the following changes:
Change cmd.CommandText = "UPDATE bm00ts0001 SET imgarray = ? WHERE tid =
'" & vartid & "'" To cmd.CommandText = "UPDATE bm00ts0001 SET imgarray = @imgarray WHERE
tid = '" & vartid & "'"
Change Dim param As SqlCeParameter = cmd.Parameters. Add("imgarray", SqlDbType.Image ) To Dim param As SqlCeParameter = cmd.Parameters. Add("@imgarray" , SqlDbType.Image )
Making these changes meant this code worked for me on a normal (not
CE) SQL Server.
-- Larry Lard Replies to group please This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jason Huang |
last post by:
Hi,
The SqlParameter myPM =new SqlParameter("@Address", txtAddress.Text) is
working for update,
but SqlParameter myPM =new SqlParameter
("@Address",SqlDbType.NVarChar,90,txtAddress.Text) is not working.
The Address column is DataType NVarChar 90, no problem.
Any idea?
|
by: Jim Hammond |
last post by:
It would be udeful to be able to get the current on-screen values from a
FormView that is databound to an ObjectDataSource by using a callback instead
of a postback. For example:
public void RaiseCallbackEvent(string eventArgs)
{
// update the data object with the values currently on screen
FormView1.UpdateItem(true);
}
|
by: Zorpiedoman |
last post by:
I keep getting a concurrency exception the second time I make a change and
attempt to update a dataadapter. It appears this is by design, so there must
be something I can do to avoid it.
Example:
I have a dataadapter that contains one table with one row. I change the
value of the 'FisrtName' column in that row from Jack to John. I call
..update on the dataadapter it goes through fine. Now I change that same
column in that same row...
|
by: drakuu |
last post by:
Hello there,
I have DataGrid with some records and I would like to edit it right in
the datagrid using the built in commands.
I can't figure out a way to pass to the SQL query the record ID which
I'm editing.
SELECT:
SelectCommand="SELECT ProviderID, AddressID, Address, Address2, City,
State, County, Zip FROM ProviderAddress WHERE (ProviderID =
@ProviderID)"
|
by: Luigi |
last post by:
Hi all,
I have the GridView with this code:
<asp:GridView OnDataBound="VisualizzaExcel" EnableViewState="False"
ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="COD_SALDO" DataSourceID="SqlDataSource1" CellPadding="4"
ForeColor="#333333" GridLines="None" Width="470px">
<Columns>
<asp:BoundField DataField="COD_SALDO"
| |
by: troyblakely |
last post by:
I have a gridview which is pulling data from a SqlDataSource, the
select command queries a view and the update command is a stored
procedure. I'm using a stored procedure because several tables need to
be updated based on the data in the gridview.
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:slightsInventoryConnectionString %>"
SelectCommand="SELECT * FROM "
UpdateCommand="upd_Inventory"...
|
by: =?Utf-8?B?QmFidU1hbg==?= |
last post by:
Hi,
I have a GridView and a SqlDataSource controls on a page. The SqlDataSource
object uses stored procedures to do the CRUD operations. The DataSource has
three columns one of which - "Modified" of type DateTime - is hidden since it
should not be edited by a user. The system handles the update for this
column. So, I have hidden (Visible=false) this column on the grid. In order
to access the value in this field, I have created a...
|
by: Brad Baker |
last post by:
I have a formview with a datasource that contains a select and update
command. The select statement works fine but the update command doesn't seem
to be working. After some troubleshooting I have narrowed the problem down
to the department_id parameter which is set from a hidden field.
I can confirm this by hard coding the UpdateCommand to: UPDATE configuration
SET special_notes=@special_notes WHERE (student_id=@student_id) AND...
|
by: sirdavethebrave |
last post by:
Hi guys -
I have written a form, and a stored procedure to update the said form.
It really is as simple as that. A user can go into the form, update some fields and hit the update button to update the information which is stored in a SQL database.
In testing we noticed that the form was updating correctly but the update mechanism was also updating the first record of the table in the sql database every time. No error messages are on...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |