Showing posts with label created. Show all posts
Showing posts with label created. Show all posts

Thursday, March 29, 2012

error 18456 when trying to connect to 2005 using odbc

Hi all

I am using Windows XP SP2 with a Sql server 2005 Express installation. I created a test db with a user called test, schema also test. I gave the permission connect, db_datareader and db_datawriter. I can now connect into this user using WinSQL. But if I want to connect using a application which is using ODBC, then I get the error:

[SQLSTATE=28000 - [Microsoft][SQL Native][SQL Server]Login failed for user 'test'.[Native Error=18456]]

Because I connect using ODBC, I think there must be the problem. But I have to connect with ODBC. There is no other possibility.

any ideas ?

Regards, Waff

I found this out:

The server collation is defined to: Latin1_General_CI_AS

If I create a new login id in lowercase, then ODBC will change it to uppercase and then the server refuse the access. But why. CI means case insensitive, so doesn't matter if upper or lower case. should.

How do you use a id in lowercase and connecto via ODBC ?

You need to enable TCP in order for ODBC clients to connect. Check out http://blogs.msdn.com/sqlexpress/archive/2004/07/23/192044.aspx for information about doing this.

Mike

|||

Guess has something to do with the collation. I used Latin1_General_AI_CI.

If I create my login id in lowercase and try then to connect to the db using ODBC, then ODBC will switch my id to uppercase and so I can't logon.

Anyway, somehow, it must be possible to modify the server settings, so that it doesn't matter how I logon. lowercase or uppercase. I tryed with CI and CS but still them same.

ODBC is enabled but think has to do with the collation.

What are you using if you use id's as upper/lower case as Test ?

error 18456 when trying to connect to 2005 using odbc

Hi all

I am using Windows XP SP2 with a Sql server 2005 Express installation. I created a test db with a user called test, schema also test. I gave the permission connect, db_datareader and db_datawriter. I can now connect into this user using WinSQL. But if I want to connect using a application which is using ODBC, then I get the error:

[SQLSTATE=28000 - [Microsoft][SQL Native][SQL Server]Login failed for user 'test'.[Native Error=18456]]

Because I connect using ODBC, I think there must be the problem. But I have to connect with ODBC. There is no other possibility.

any ideas ?

Regards, Waff

I found this out:

The server collation is defined to: Latin1_General_CI_AS

If I create a new login id in lowercase, then ODBC will change it to uppercase and then the server refuse the access. But why. CI means case insensitive, so doesn't matter if upper or lower case. should.

How do you use a id in lowercase and connecto via ODBC ?

You need to enable TCP in order for ODBC clients to connect. Check out http://blogs.msdn.com/sqlexpress/archive/2004/07/23/192044.aspx for information about doing this.

Mike

|||

Guess has something to do with the collation. I used Latin1_General_AI_CI.

If I create my login id in lowercase and try then to connect to the db using ODBC, then ODBC will switch my id to uppercase and so I can't logon.

Anyway, somehow, it must be possible to modify the server settings, so that it doesn't matter how I logon. lowercase or uppercase. I tryed with CI and CS but still them same.

ODBC is enabled but think has to do with the collation.

What are you using if you use id's as upper/lower case as Test ?

Tuesday, March 27, 2012

Error 18452

I have created a user (calladmin2) of a database in SQL Server Enterprise
Manager. When I load SQL Query Analyzer and attempt to File->Connect using
this user name I get:
Msg. 18452, Level 16, State 1
Login failed for user 'calladmin2'. reason: Not associated with a trusted
SQL Server connection.
It appears that I cannot connect to this instance of SQL Server, and am not
even getting to the single database to which I gave this new user access
rights. Is this correct?
How do I create the 'trusted SQL Server connection' that SQL Server wants
for this new user calladmin2?
Many thanks.
Andrew,
Here is link to the article about troubleshooting connectivity issues:
http://support.microsoft.com/default...;en-us;827422.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Andrew Chalk" <achalk@.XXXmagnacartasoftware.com> wrote in message
news:eVdbwXjsEHA.2808@.TK2MSFTNGP14.phx.gbl...
> I have created a user (calladmin2) of a database in SQL Server Enterprise
> Manager. When I load SQL Query Analyzer and attempt to File->Connect using
> this user name I get:
> Msg. 18452, Level 16, State 1
> Login failed for user 'calladmin2'. reason: Not associated with a trusted
> SQL Server connection.
> It appears that I cannot connect to this instance of SQL Server, and am
not
> even getting to the single database to which I gave this new user access
> rights. Is this correct?
> How do I create the 'trusted SQL Server connection' that SQL Server wants
> for this new user calladmin2?
> Many thanks.
>
|||Thanks. That had the answer -- LoginMode in the registry.
- Andrew
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si > wrote in
message news:%23CMFB4nsEHA.820@.TK2MSFTNGP12.phx.gbl...[vbcol=seagreen]
> Andrew,
> Here is link to the article about troubleshooting connectivity issues:
> http://support.microsoft.com/default...;en-us;827422.
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
> www.SolidQualityLearning.com
> "Andrew Chalk" <achalk@.XXXmagnacartasoftware.com> wrote in message
> news:eVdbwXjsEHA.2808@.TK2MSFTNGP14.phx.gbl...
Enterprise[vbcol=seagreen]
using[vbcol=seagreen]
trusted[vbcol=seagreen]
> not
wants
>

Error 18452

I have created a user (calladmin2) of a database in SQL Server Enterprise
Manager. When I load SQL Query Analyzer and attempt to File->Connect using
this user name I get:
Msg. 18452, Level 16, State 1
Login failed for user 'calladmin2'. reason: Not associated with a trusted
SQL Server connection.
It appears that I cannot connect to this instance of SQL Server, and am not
even getting to the single database to which I gave this new user access
rights. Is this correct?
How do I create the 'trusted SQL Server connection' that SQL Server wants
for this new user calladmin2?
Many thanks.Andrew,
Here is link to the article about troubleshooting connectivity issues:
http://support.microsoft.com/defaul...b;en-us;827422.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Andrew Chalk" <achalk@.XXXmagnacartasoftware.com> wrote in message
news:eVdbwXjsEHA.2808@.TK2MSFTNGP14.phx.gbl...
> I have created a user (calladmin2) of a database in SQL Server Enterprise
> Manager. When I load SQL Query Analyzer and attempt to File->Connect using
> this user name I get:
> Msg. 18452, Level 16, State 1
> Login failed for user 'calladmin2'. reason: Not associated with a trusted
> SQL Server connection.
> It appears that I cannot connect to this instance of SQL Server, and am
not
> even getting to the single database to which I gave this new user access
> rights. Is this correct?
> How do I create the 'trusted SQL Server connection' that SQL Server wants
> for this new user calladmin2?
> Many thanks.
>|||Thanks. That had the answer -- LoginMode in the registry.
- Andrew
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
message news:%23CMFB4nsEHA.820@.TK2MSFTNGP12.phx.gbl...
> Andrew,
> Here is link to the article about troubleshooting connectivity issues:
> http://support.microsoft.com/defaul...b;en-us;827422.
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
> www.SolidQualityLearning.com
> "Andrew Chalk" <achalk@.XXXmagnacartasoftware.com> wrote in message
> news:eVdbwXjsEHA.2808@.TK2MSFTNGP14.phx.gbl...
Enterprise[vbcol=seagreen]
using[vbcol=seagreen]
trusted[vbcol=seagreen]
> not
wants[vbcol=seagreen]
>

Thursday, March 22, 2012

Error 15023 : User or role "abc" already exists in current database

I have restored a database which has tables belonging to a
particular user account created. However, after
restoration, I am not able to see the user account in the
User/Logins item and not able to create a new account with
the same name and making it the db_owner at the same time.
The system gives me this error.
Using sp_helpusers for this database, I realised that
there is a user account with the name "abc" but there is
no value in the "loginName" & "DefDBName" fields.
Please advise how I can sync this.
Thanks.It sounds as though the user is orphaned
Exec sp_change_users_login 'Report'
will show you this info
You can use the 'Update_One' parameter to match things up
OR you could simply use
Exec sp_revokedbaccess 'Name in DB'
EXEC sp_grantdbaccess [@.loginame =] 'login'
[,[@.name_in_db =] 'name_in_db' [OUTPUT]]
--
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Dara" <dara.lim@.ogilvy.com> wrote in message
news:075e01c35bf0$2360f020$a501280a@.phx.gbl...
> I have restored a database which has tables belonging to a
> particular user account created. However, after
> restoration, I am not able to see the user account in the
> User/Logins item and not able to create a new account with
> the same name and making it the db_owner at the same time.
> The system gives me this error.
> Using sp_helpusers for this database, I realised that
> there is a user account with the name "abc" but there is
> no value in the "loginName" & "DefDBName" fields.
> Please advise how I can sync this.
> Thanks.|||Hi Dara,
If you have a login for that user on your server you can use the
sp_change_users_login stored procedure to fix your problems. See Books
Online for the details.
--
Jacco Schalkwijk MCDBA, MCSD, MCSE
Database Administrator
Eurostop Ltd.
"Dara" <dara.lim@.ogilvy.com> wrote in message
news:075e01c35bf0$2360f020$a501280a@.phx.gbl...
> I have restored a database which has tables belonging to a
> particular user account created. However, after
> restoration, I am not able to see the user account in the
> User/Logins item and not able to create a new account with
> the same name and making it the db_owner at the same time.
> The system gives me this error.
> Using sp_helpusers for this database, I realised that
> there is a user account with the name "abc" but there is
> no value in the "loginName" & "DefDBName" fields.
> Please advise how I can sync this.
> Thanks.

Wednesday, March 21, 2012

Error 14266 - Is 11:59:59 PM not a valid time?

Hi,
I created a DTS package and wanted to schedule it to run at 11:59:59 PM. I
could not save the schedule.
An error "Error 14266: The specified '@.active_end_time' is invalid (valid
values are: before or after @.active_start_time). The job was not saved."
I tried 11:59:58 PM and 12:00:00 AM, both schedules can be saved. Why
11:59:59 PM not ?
Please help,
It sounds like this is from what you are selecting in the
daily frequency section when you schedule the job.
Without the details of this, I'd guess you are selecting
something like "occurs every 24 hours" with "starting at
11:59:59 PM" and "ending at 11:59:59 PM". That will give the
error you have.
If you want the job to run daily at 11:59:59 PM, select the
"occurs once at " option (the first one in the daily
frequency section). It will run once a day (or at whatever
interval you have set or want set in the Occurs section) at
11:59:59 PM.
-Sue
On Thu, 20 Jan 2005 09:03:09 -0800, "Julia"
<Julia@.discussions.microsoft.com> wrote:

>Hi,
>I created a DTS package and wanted to schedule it to run at 11:59:59 PM. I
>could not save the schedule.
>An error "Error 14266: The specified '@.active_end_time' is invalid (valid
>values are: before or after @.active_start_time). The job was not saved."
>I tried 11:59:58 PM and 12:00:00 AM, both schedules can be saved. Why
>11:59:59 PM not ?
>Please help,
|||Selecting "Occurrs Once At:" with a time of 11:59:59 PM will not work.
The scheduling wizard assumes that the end time is 11:59:59 PM. This is
why you get the error 14266. Enter any other time and it will work.
You can easily verify this by entering a different time and saving it.
Then right click on the associated job. Select "All Tasks > Generate
SQL Script...
A dialog box will appear "Generate SQL Script - SERVER NAME/JOB NAME"
Click on the preview button. Click on the copy button and paste into a
text editor. Search for "@.active_end_time"
you will see that it is set to 235959.
Sue Hoegemeier Wrote:[vbcol=seagreen]
> It sounds like this is from what you are selecting in the
> daily frequency section when you schedule the job.
> Without the details of this, I'd guess you are selecting
> something like "occurs every 24 hours" with "starting at
> 11:59:59 PM" and "ending at 11:59:59 PM". That will give the
> error you have.
> If you want the job to run daily at 11:59:59 PM, select the
> "occurs once at " option (the first one in the daily
> frequency section). It will run once a day (or at whatever
> interval you have set or want set in the Occurs section) at
> 11:59:59 PM.
> -Sue
> On Thu, 20 Jan 2005 09:03:09 -0800, "Julia"
> <Julia@.discussions.microsoft.com> wrote:
> PM. I
> (valid
> saved."
bdatch
bdatch's Profile: http://www.msusenet.com/member.php?userid=675
View this thread: http://www.msusenet.com/t-3298150

Error 14266 - Is 11:59:59 PM not a valid time?

Hi,
I created a DTS package and wanted to schedule it to run at 11:59:59 PM. I
could not save the schedule.
An error "Error 14266: The specified '@.active_end_time' is invalid (valid
values are: before or after @.active_start_time). The job was not saved."
I tried 11:59:58 PM and 12:00:00 AM, both schedules can be saved. Why
11:59:59 PM not ?
Please help,It sounds like this is from what you are selecting in the
daily frequency section when you schedule the job.
Without the details of this, I'd guess you are selecting
something like "occurs every 24 hours" with "starting at
11:59:59 PM" and "ending at 11:59:59 PM". That will give the
error you have.
If you want the job to run daily at 11:59:59 PM, select the
"occurs once at " option (the first one in the daily
frequency section). It will run once a day (or at whatever
interval you have set or want set in the Occurs section) at
11:59:59 PM.
-Sue
On Thu, 20 Jan 2005 09:03:09 -0800, "Julia"
<Julia@.discussions.microsoft.com> wrote:

>Hi,
>I created a DTS package and wanted to schedule it to run at 11:59:59 PM. I
>could not save the schedule.
>An error "Error 14266: The specified '@.active_end_time' is invalid (valid
>values are: before or after @.active_start_time). The job was not saved."
>I tried 11:59:58 PM and 12:00:00 AM, both schedules can be saved. Why
>11:59:59 PM not ?
>Please help,|||Selecting "Occurrs Once At:" with a time of 11:59:59 PM will not work.
The scheduling wizard assumes that the end time is 11:59:59 PM. This is
why you get the error 14266. Enter any other time and it will work.
You can easily verify this by entering a different time and saving it.
Then right click on the associated job. Select "All Tasks > Generate
SQL Script...
A dialog box will appear "Generate SQL Script - SERVER NAME/JOB NAME"
Click on the preview button. Click on the copy button and paste into a
text editor. Search for "@.active_end_time"
you will see that it is set to 235959.
Sue Hoegemeier Wrote:[vbcol=seagreen]
> It sounds like this is from what you are selecting in the
> daily frequency section when you schedule the job.
> Without the details of this, I'd guess you are selecting
> something like "occurs every 24 hours" with "starting at
> 11:59:59 PM" and "ending at 11:59:59 PM". That will give the
> error you have.
> If you want the job to run daily at 11:59:59 PM, select the
> "occurs once at " option (the first one in the daily
> frequency section). It will run once a day (or at whatever
> interval you have set or want set in the Occurs section) at
> 11:59:59 PM.
> -Sue
> On Thu, 20 Jan 2005 09:03:09 -0800, "Julia"
> <Julia@.discussions.microsoft.com> wrote:
>
> PM. I
> (valid
> saved."
bdatch
---
bdatch's Profile: http://www.msmcse.ms/member.php?userid=675
View this thread: http://www.msmcse.ms/t-3298150

Error 14266 - Is 11:59:59 PM not a valid time?

Hi,
I created a DTS package and wanted to schedule it to run at 11:59:59 PM. I
could not save the schedule.
An error "Error 14266: The specified '@.active_end_time' is invalid (valid
values are: before or after @.active_start_time). The job was not saved."
I tried 11:59:58 PM and 12:00:00 AM, both schedules can be saved. Why
11:59:59 PM not ?
Please help,It sounds like this is from what you are selecting in the
daily frequency section when you schedule the job.
Without the details of this, I'd guess you are selecting
something like "occurs every 24 hours" with "starting at
11:59:59 PM" and "ending at 11:59:59 PM". That will give the
error you have.
If you want the job to run daily at 11:59:59 PM, select the
"occurs once at " option (the first one in the daily
frequency section). It will run once a day (or at whatever
interval you have set or want set in the Occurs section) at
11:59:59 PM.
-Sue
On Thu, 20 Jan 2005 09:03:09 -0800, "Julia"
<Julia@.discussions.microsoft.com> wrote:
>Hi,
>I created a DTS package and wanted to schedule it to run at 11:59:59 PM. I
>could not save the schedule.
>An error "Error 14266: The specified '@.active_end_time' is invalid (valid
>values are: before or after @.active_start_time). The job was not saved."
>I tried 11:59:58 PM and 12:00:00 AM, both schedules can be saved. Why
>11:59:59 PM not ?
>Please help,|||Selecting "Occurrs Once At:" with a time of 11:59:59 PM will not work
The scheduling wizard assumes that the end time is 11:59:59 PM. This i
why you get the error 14266. Enter any other time and it will work.
You can easily verify this by entering a different time and saving it
Then right click on the associated job. Select "All Tasks > Generat
SQL Script...
A dialog box will appear "Generate SQL Script - SERVER NAME/JOB NAME"
Click on the preview button. Click on the copy button and paste into
text editor. Search for "@.active_end_time"
you will see that it is set to 235959.
Sue Hoegemeier Wrote:
> It sounds like this is from what you are selecting in the
> daily frequency section when you schedule the job.
> Without the details of this, I'd guess you are selecting
> something like "occurs every 24 hours" with "starting at
> 11:59:59 PM" and "ending at 11:59:59 PM". That will give the
> error you have.
> If you want the job to run daily at 11:59:59 PM, select the
> "occurs once at " option (the first one in the daily
> frequency section). It will run once a day (or at whatever
> interval you have set or want set in the Occurs section) at
> 11:59:59 PM.
> -Sue
> On Thu, 20 Jan 2005 09:03:09 -0800, "Julia"
> <Julia@.discussions.microsoft.com> wrote:
> >Hi,
> >
> >I created a DTS package and wanted to schedule it to run at 11:59:5
> PM. I
> >could not save the schedule.
> >
> >An error "Error 14266: The specified '@.active_end_time' is invali
> (valid
> >values are: before or after @.active_start_time). The job was no
> saved."
> >
> >I tried 11:59:58 PM and 12:00:00 AM, both schedules can be saved. Why
> >11:59:59 PM not ?
> >
> >Please help
--
bdatc
----
bdatch's Profile: http://www.msusenet.com/member.php?userid=67
View this thread: http://www.msusenet.com/t-329815sql

Sunday, March 11, 2012

error 1069: The service did not start due to logon problems

The local sql server that was working fine earlier does not start now. I have already created tables and accessed them using stored procedures.

I get an error 1069: The service did not start due to logon problems. I have only changed my domain password. I do not remember what authentication I chose for log on.

Any suggestions would be helpful.

Thanks

try this article:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q282254

error 1069: The service did not start due to logon problems

The local sql server that was working fine earlier does not start now. I have already created tables and accessed them using stored procedures.

I get an error 1069: The service did not start due to logon problems. I have only changed my domain password. I do not remember what authentication I chose for log on.

Any suggestions would be helpful.

Thanks

try this article:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q282254

Wednesday, March 7, 2012

Error 07002 - SQLBindParameter not used for all parameters

Hi, I created a simple VB.NET 2003 application through Visual Studio
that connects to a MySQL database and loads a table into a Dataset, and
then displays that table information in a DataGrid on a form for
editing. The table fill works fine, the delete function works fine, but
when I try to update a row, the application fails with the following
error message:
An unhandled exception of type 'System.Data.Odbc.OdbcException' occurred
in system.data.dll
Additional information: System error.
'Data Access VB App.exe': Loaded
'c:\windows\assembly\gac\microsoft.visualbasic\7.0 .5000.0__b03f5f7f11d50
a3a\microsoft.visualbasic.dll', No symbols loaded.
Unhandled Exception: System.Data.Odbc.OdbcException: ERROR [07002]
[MySQL][ODBC 3.51 Driver][mysqld-4.0.21-debug]SQLBindParameter not used
for all parameters
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
srcTable)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet)
at Data_Access_VB_App.Form1.btnUpdate_Click(Object sender, EventArgs
e) in C:\Documents and Settings\System Admin\My Documents\Visual Studio
Projects\Data Access VB App\Form1.vb:line 225
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProThe program '[2608] Data Access
VB App.exe' has exited with code 0 (0x0).
c(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG&
msg)
at
System.Windows.Forms.ComponentManager.System.Windo ws.Forms.UnsafeNativeM
ethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32
reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopI nner(Int32
reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop( Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Data_Access_VB_App.Form1.Main() in C:\Documents and
Settings\System Admin\My Documents\Visual Studio Projects\Data Access VB
App\Form1.vb:line 1
The majority of the code was generated by Visual Studio and based on the
error message it would seem that I have to add SQLBindParameter
statements, but I am not sure the syntax that I should be using. I am
new to VB.NET (coming from Java/J2EE) and haven't been able to come up
with a workable solution after pouring over the MSDN manuals. Here is
the generated code:
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents OdbcDataAdapter1 As
System.Data.Odbc.OdbcDataAdapter
Friend WithEvents OdbcConnection1 As System.Data.Odbc.OdbcConnection
Friend WithEvents DsTags1 As Data_Access_VB_App.dsTags
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents btnUpdate As System.Windows.Forms.Button
Friend WithEvents btnLoad As System.Windows.Forms.Button
Friend WithEvents OdbcDataAdapter2 As
System.Data.Odbc.OdbcDataAdapter
Friend WithEvents OdbcSelectCommand2 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcInsertCommand2 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcConnection2 As System.Data.Odbc.OdbcConnection
Friend WithEvents OdbcDeleteCommand2 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcUpdateCommand2 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcSelectCommand1 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcInsertCommand1 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcDeleteCommand1 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcUpdateCommand1 As System.Data.Odbc.OdbcCommand
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.OdbcDataAdapter1 = New System.Data.Odbc.OdbcDataAdapter
Me.OdbcConnection1 = New System.Data.Odbc.OdbcConnection
Me.DsTags1 = New Data_Access_VB_App.dsTags
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.btnUpdate = New System.Windows.Forms.Button
Me.btnLoad = New System.Windows.Forms.Button
Me.OdbcDataAdapter2 = New System.Data.Odbc.OdbcDataAdapter
Me.OdbcDeleteCommand2 = New System.Data.Odbc.OdbcCommand
Me.OdbcConnection2 = New System.Data.Odbc.OdbcConnection
Me.OdbcInsertCommand2 = New System.Data.Odbc.OdbcCommand
Me.OdbcSelectCommand2 = New System.Data.Odbc.OdbcCommand
Me.OdbcUpdateCommand2 = New System.Data.Odbc.OdbcCommand
Me.OdbcSelectCommand1 = New System.Data.Odbc.OdbcCommand
Me.OdbcInsertCommand1 = New System.Data.Odbc.OdbcCommand
Me.OdbcDeleteCommand1 = New System.Data.Odbc.OdbcCommand
Me.OdbcUpdateCommand1 = New System.Data.Odbc.OdbcCommand
CType(Me.DsTags1,
System.ComponentModel.ISupportInitialize).BeginIni t()
CType(Me.DataGrid1,
System.ComponentModel.ISupportInitialize).BeginIni t()
Me.SuspendLayout()
'
'OdbcDataAdapter1
'
Me.OdbcDataAdapter1.DeleteCommand = Me.OdbcDeleteCommand1
Me.OdbcDataAdapter1.InsertCommand = Me.OdbcInsertCommand1
Me.OdbcDataAdapter1.SelectCommand = Me.OdbcSelectCommand1
Me.OdbcDataAdapter1.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "epctag", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("ID", "ID"), New
System.Data.Common.DataColumnMapping("OBJECT_EPC", "OBJECT_EPC"), New
System.Data.Common.DataColumnMapping("READER_EPC", "READER_EPC"), New
System.Data.Common.DataColumnMapping("DATE_TIME", "DATE_TIME"), New
System.Data.Common.DataColumnMapping("PAYLOAD", "PAYLOAD"), New
System.Data.Common.DataColumnMapping("GTIN_DOMAIN" , "GTIN_DOMAIN"), New
System.Data.Common.DataColumnMapping("GTIN_CLASS", "GTIN_CLASS")})})
Me.OdbcDataAdapter1.UpdateCommand = Me.OdbcUpdateCommand1
'
'OdbcConnection1
'
Me.OdbcConnection1.ConnectionString =
"STMT=;OPTION=3;DSN=EPCThingsNET;UID=root;SOCKET=; DESC=MySQL ODBC 3.51
Driver DSN;" & _
"DATABASE=thingsnet;SERVER=localhost;PORT=3306 "
'
'DsTags1
'
Me.DsTags1.DataSetName = "dsTags"
Me.DsTags1.Locale = New
System.Globalization.CultureInfo("en-US")
'
'DataGrid1
'
Me.DataGrid1.DataMember = "epctag"
Me.DataGrid1.DataSource = Me.DsTags1
Me.DataGrid1.HeaderForeColor =
System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(8, 128)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(584, 264)
Me.DataGrid1.TabIndex = 0
'
'btnUpdate
'
Me.btnUpdate.Location = New System.Drawing.Point(224, 48)
Me.btnUpdate.Name = "btnUpdate"
Me.btnUpdate.Size = New System.Drawing.Size(152, 23)
Me.btnUpdate.TabIndex = 1
Me.btnUpdate.Text = "Save Changes in Database"
'
'btnLoad
'
Me.btnLoad.Location = New System.Drawing.Point(56, 40)
Me.btnLoad.Name = "btnLoad"
Me.btnLoad.TabIndex = 2
Me.btnLoad.Text = "Load Data"
'
'OdbcSelectCommand1
'
Me.OdbcSelectCommand1.CommandText = "SELECT ID, OBJECT_EPC,
READER_EPC, DATE_TIME, PAYLOAD, GTIN_DOMAIN, GTIN_CLASS FR" & _
"OM epctag"
Me.OdbcSelectCommand1.Connection = Me.OdbcConnection1
'
'OdbcInsertCommand1
'
Me.OdbcInsertCommand1.CommandText = "INSERT INTO epctag(ID,
OBJECT_EPC, READER_EPC, DATE_TIME, PAYLOAD, GTIN_DOMAIN, G" & _
"TIN_CLASS) VALUES (?, ?, ?, ?, ?, ?, ?)"
Me.OdbcInsertCommand1.Connection = Me.OdbcConnection1
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("ID", System.Data.Odbc.OdbcType.BigInt,
0, "ID"))
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("OBJECT_EPC",
System.Data.Odbc.OdbcType.VarChar, 255, "OBJECT_EPC"))
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("READER_EPC",
System.Data.Odbc.OdbcType.VarChar, 255, "READER_EPC"))
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("DATE_TIME",
System.Data.Odbc.OdbcType.VarChar, 255, "DATE_TIME"))
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("PAYLOAD",
System.Data.Odbc.OdbcType.VarChar, 255, "PAYLOAD"))
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("GTIN_DOMAIN",
System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_DOMAIN"))
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("GTIN_CLASS",
System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_CLASS"))
'
'OdbcDeleteCommand1
'
Me.OdbcDeleteCommand1.CommandText = "DELETE FROM epctag WHERE
(ID = ?)"
Me.OdbcDeleteCommand1.Connection = Me.OdbcConnection1
Me.OdbcDeleteCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("ID", System.Data.Odbc.OdbcType.BigInt,
0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ID", System.Data.DataRowVersion.Original, Nothing))
'
'OdbcUpdateCommand1
'
Me.OdbcUpdateCommand1.CommandText = "UPDATE ecptag SET ID = ?,
OBJECT_EPC = ?, READER_EPC = ?, DATE_TIME = ?, PAYLOAD " & _
"= ?, GTIN_DOMAIN = ?, GTIN_CLASS = ? WHERE (ID = ?)"
Me.OdbcUpdateCommand1.Connection = Me.OdbcConnection1
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("ID", System.Data.Odbc.OdbcType.BigInt,
0, "ID"))
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("OBJECT_EPC",
System.Data.Odbc.OdbcType.VarChar, 255, "OBJECT_EPC"))
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("READER_EPC",
System.Data.Odbc.OdbcType.VarChar, 255, "READER_EPC"))
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("DATE_TIME",
System.Data.Odbc.OdbcType.VarChar, 255, "DATE_TIME"))
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("PAYLOAD",
System.Data.Odbc.OdbcType.VarChar, 255, "PAYLOAD"))
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("GTIN_DOMAIN",
System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_DOMAIN"))
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("GTIN_CLASS",
System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_CLASS"))
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(608, 398)
Me.Controls.Add(Me.btnLoad)
Me.Controls.Add(Me.btnUpdate)
Me.Controls.Add(Me.DataGrid1)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.DsTags1,
System.ComponentModel.ISupportInitialize).EndInit( )
CType(Me.DataGrid1,
System.ComponentModel.ISupportInitialize).EndInit( )
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnUpdate.Click
OdbcDataAdapter1.Update(DsTags1)
MessageBox.Show("Database Updated!")
End Sub
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLoad.Click
OdbcDataAdapter1.Fill(DsTags1)
MessageBox.Show("Data Table Loaded Successfully!")
End Sub
End Class
That's the long and short of it! Appreciate any help.
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
You aren't binding the correct number of parameters for the update command.
You are expecting ODBC to use the "ID" parameter twice, but that wont
happen. You have to bind an OdbcParameter object for each '?'. If you have
8 parameter markers, you must bind 8 parameters. You are only binding 7
parameters.
Brannon
"Mikey G" <nospam@.devdex.com> wrote in message
news:#M02y8hsEHA.2808@.TK2MSFTNGP14.phx.gbl...
> Hi, I created a simple VB.NET 2003 application through Visual Studio
> that connects to a MySQL database and loads a table into a Dataset, and
> then displays that table information in a DataGrid on a form for
> editing. The table fill works fine, the delete function works fine, but
> when I try to update a row, the application fails with the following
> error message:
> An unhandled exception of type 'System.Data.Odbc.OdbcException' occurred
> in system.data.dll
> Additional information: System error.
> 'Data Access VB App.exe': Loaded
> 'c:\windows\assembly\gac\microsoft.visualbasic\7.0 .5000.0__b03f5f7f11d50
> a3a\microsoft.visualbasic.dll', No symbols loaded.
> Unhandled Exception: System.Data.Odbc.OdbcException: ERROR [07002]
> [MySQL][ODBC 3.51 Driver][mysqld-4.0.21-debug]SQLBindParameter not used
> for all parameters
> at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
> DataTableMapping tableMapping)
> at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
> srcTable)
> at System.Data.Common.DbDataAdapter.Update(DataSet dataSet)
> at Data_Access_VB_App.Form1.btnUpdate_Click(Object sender, EventArgs
> e) in C:\Documents and Settings\System Admin\My Documents\Visual Studio
> Projects\Data Access VB App\Form1.vb:line 225
> at System.Windows.Forms.Control.OnClick(EventArgs e)
> at System.Windows.Forms.Button.OnClick(EventArgs e)
> at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
> at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
> button, Int32 clicks)
> at System.Windows.Forms.Control.WndProc(Message& m)
> at System.Windows.Forms.ButtonBase.WndProc(Message& m)
> at System.Windows.Forms.Button.WndProThe program '[2608] Data Access
> VB App.exe' has exited with code 0 (0x0).
> c(Message& m)
> at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
> at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
> at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd,
> Int32 msg, IntPtr wparam, IntPtr lparam)
> at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG&
> msg)
> at
> System.Windows.Forms.ComponentManager.System.Windo ws.Forms.UnsafeNativeM
> ethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32
> reason, Int32 pvLoopData)
> at System.Windows.Forms.ThreadContext.RunMessageLoopI nner(Int32
> reason, ApplicationContext context)
> at System.Windows.Forms.ThreadContext.RunMessageLoop( Int32 reason,
> ApplicationContext context)
> at System.Windows.Forms.Application.Run(Form mainForm)
> at Data_Access_VB_App.Form1.Main() in C:\Documents and
> Settings\System Admin\My Documents\Visual Studio Projects\Data Access VB
> App\Form1.vb:line 1
>
> The majority of the code was generated by Visual Studio and based on the
> error message it would seem that I have to add SQLBindParameter
> statements, but I am not sure the syntax that I should be using. I am
> new to VB.NET (coming from Java/J2EE) and haven't been able to come up
> with a workable solution after pouring over the MSDN manuals. Here is
> the generated code:
>
> Public Class Form1
> Inherits System.Windows.Forms.Form
> #Region " Windows Form Designer generated code "
> Public Sub New()
> MyBase.New()
> 'This call is required by the Windows Form Designer.
> InitializeComponent()
> 'Add any initialization after the InitializeComponent() call
> End Sub
> 'Form overrides dispose to clean up the component list.
> Protected Overloads Overrides Sub Dispose(ByVal disposing As
> Boolean)
> If disposing Then
> If Not (components Is Nothing) Then
> components.Dispose()
> End If
> End If
> MyBase.Dispose(disposing)
> End Sub
> 'NOTE: The following procedure is required by the Windows Form Designer
> 'It can be modified using the Windows Form Designer.
> 'Do not modify it using the code editor.
> Friend WithEvents OdbcDataAdapter1 As
> System.Data.Odbc.OdbcDataAdapter
> Friend WithEvents OdbcConnection1 As System.Data.Odbc.OdbcConnection
> Friend WithEvents DsTags1 As Data_Access_VB_App.dsTags
> Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
> Friend WithEvents btnUpdate As System.Windows.Forms.Button
> Friend WithEvents btnLoad As System.Windows.Forms.Button
> Friend WithEvents OdbcDataAdapter2 As
> System.Data.Odbc.OdbcDataAdapter
> Friend WithEvents OdbcSelectCommand2 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcInsertCommand2 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcConnection2 As System.Data.Odbc.OdbcConnection
> Friend WithEvents OdbcDeleteCommand2 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcUpdateCommand2 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcSelectCommand1 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcInsertCommand1 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcDeleteCommand1 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcUpdateCommand1 As System.Data.Odbc.OdbcCommand
> <System.Diagnostics.DebuggerStepThrough()> Private Sub
> InitializeComponent()
> Me.OdbcDataAdapter1 = New System.Data.Odbc.OdbcDataAdapter
> Me.OdbcConnection1 = New System.Data.Odbc.OdbcConnection
> Me.DsTags1 = New Data_Access_VB_App.dsTags
> Me.DataGrid1 = New System.Windows.Forms.DataGrid
> Me.btnUpdate = New System.Windows.Forms.Button
> Me.btnLoad = New System.Windows.Forms.Button
> Me.OdbcDataAdapter2 = New System.Data.Odbc.OdbcDataAdapter
> Me.OdbcDeleteCommand2 = New System.Data.Odbc.OdbcCommand
> Me.OdbcConnection2 = New System.Data.Odbc.OdbcConnection
> Me.OdbcInsertCommand2 = New System.Data.Odbc.OdbcCommand
> Me.OdbcSelectCommand2 = New System.Data.Odbc.OdbcCommand
> Me.OdbcUpdateCommand2 = New System.Data.Odbc.OdbcCommand
> Me.OdbcSelectCommand1 = New System.Data.Odbc.OdbcCommand
> Me.OdbcInsertCommand1 = New System.Data.Odbc.OdbcCommand
> Me.OdbcDeleteCommand1 = New System.Data.Odbc.OdbcCommand
> Me.OdbcUpdateCommand1 = New System.Data.Odbc.OdbcCommand
> CType(Me.DsTags1,
> System.ComponentModel.ISupportInitialize).BeginIni t()
> CType(Me.DataGrid1,
> System.ComponentModel.ISupportInitialize).BeginIni t()
> Me.SuspendLayout()
> '
> 'OdbcDataAdapter1
> '
> Me.OdbcDataAdapter1.DeleteCommand = Me.OdbcDeleteCommand1
> Me.OdbcDataAdapter1.InsertCommand = Me.OdbcInsertCommand1
> Me.OdbcDataAdapter1.SelectCommand = Me.OdbcSelectCommand1
> Me.OdbcDataAdapter1.TableMappings.AddRange(New
> System.Data.Common.DataTableMapping() {New
> System.Data.Common.DataTableMapping("Table", "epctag", New
> System.Data.Common.DataColumnMapping() {New
> System.Data.Common.DataColumnMapping("ID", "ID"), New
> System.Data.Common.DataColumnMapping("OBJECT_EPC", "OBJECT_EPC"), New
> System.Data.Common.DataColumnMapping("READER_EPC", "READER_EPC"), New
> System.Data.Common.DataColumnMapping("DATE_TIME", "DATE_TIME"), New
> System.Data.Common.DataColumnMapping("PAYLOAD", "PAYLOAD"), New
> System.Data.Common.DataColumnMapping("GTIN_DOMAIN" , "GTIN_DOMAIN"), New
> System.Data.Common.DataColumnMapping("GTIN_CLASS", "GTIN_CLASS")})})
> Me.OdbcDataAdapter1.UpdateCommand = Me.OdbcUpdateCommand1
> '
> 'OdbcConnection1
> '
> Me.OdbcConnection1.ConnectionString =
> "STMT=;OPTION=3;DSN=EPCThingsNET;UID=root;SOCKET=; DESC=MySQL ODBC 3.51
> Driver DSN;" & _
> "DATABASE=thingsnet;SERVER=localhost;PORT=3306 "
> '
> 'DsTags1
> '
> Me.DsTags1.DataSetName = "dsTags"
> Me.DsTags1.Locale = New
> System.Globalization.CultureInfo("en-US")
> '
> 'DataGrid1
> '
> Me.DataGrid1.DataMember = "epctag"
> Me.DataGrid1.DataSource = Me.DsTags1
> Me.DataGrid1.HeaderForeColor =
> System.Drawing.SystemColors.ControlText
> Me.DataGrid1.Location = New System.Drawing.Point(8, 128)
> Me.DataGrid1.Name = "DataGrid1"
> Me.DataGrid1.Size = New System.Drawing.Size(584, 264)
> Me.DataGrid1.TabIndex = 0
> '
> 'btnUpdate
> '
> Me.btnUpdate.Location = New System.Drawing.Point(224, 48)
> Me.btnUpdate.Name = "btnUpdate"
> Me.btnUpdate.Size = New System.Drawing.Size(152, 23)
> Me.btnUpdate.TabIndex = 1
> Me.btnUpdate.Text = "Save Changes in Database"
> '
> 'btnLoad
> '
> Me.btnLoad.Location = New System.Drawing.Point(56, 40)
> Me.btnLoad.Name = "btnLoad"
> Me.btnLoad.TabIndex = 2
> Me.btnLoad.Text = "Load Data"
> '
> 'OdbcSelectCommand1
> '
> Me.OdbcSelectCommand1.CommandText = "SELECT ID, OBJECT_EPC,
> READER_EPC, DATE_TIME, PAYLOAD, GTIN_DOMAIN, GTIN_CLASS FR" & _
> "OM epctag"
> Me.OdbcSelectCommand1.Connection = Me.OdbcConnection1
> '
> 'OdbcInsertCommand1
> '
> Me.OdbcInsertCommand1.CommandText = "INSERT INTO epctag(ID,
> OBJECT_EPC, READER_EPC, DATE_TIME, PAYLOAD, GTIN_DOMAIN, G" & _
> "TIN_CLASS) VALUES (?, ?, ?, ?, ?, ?, ?)"
> Me.OdbcInsertCommand1.Connection = Me.OdbcConnection1
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("ID", System.Data.Odbc.OdbcType.BigInt,
> 0, "ID"))
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("OBJECT_EPC",
> System.Data.Odbc.OdbcType.VarChar, 255, "OBJECT_EPC"))
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("READER_EPC",
> System.Data.Odbc.OdbcType.VarChar, 255, "READER_EPC"))
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("DATE_TIME",
> System.Data.Odbc.OdbcType.VarChar, 255, "DATE_TIME"))
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("PAYLOAD",
> System.Data.Odbc.OdbcType.VarChar, 255, "PAYLOAD"))
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("GTIN_DOMAIN",
> System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_DOMAIN"))
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("GTIN_CLASS",
> System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_CLASS"))
> '
> 'OdbcDeleteCommand1
> '
> Me.OdbcDeleteCommand1.CommandText = "DELETE FROM epctag WHERE
> (ID = ?)"
> Me.OdbcDeleteCommand1.Connection = Me.OdbcConnection1
> Me.OdbcDeleteCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("ID", System.Data.Odbc.OdbcType.BigInt,
> 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
> Byte), "ID", System.Data.DataRowVersion.Original, Nothing))
> '
> 'OdbcUpdateCommand1
> '
> Me.OdbcUpdateCommand1.CommandText = "UPDATE ecptag SET ID = ?,
> OBJECT_EPC = ?, READER_EPC = ?, DATE_TIME = ?, PAYLOAD " & _
> "= ?, GTIN_DOMAIN = ?, GTIN_CLASS = ? WHERE (ID = ?)"
> Me.OdbcUpdateCommand1.Connection = Me.OdbcConnection1
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("ID", System.Data.Odbc.OdbcType.BigInt,
> 0, "ID"))
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("OBJECT_EPC",
> System.Data.Odbc.OdbcType.VarChar, 255, "OBJECT_EPC"))
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("READER_EPC",
> System.Data.Odbc.OdbcType.VarChar, 255, "READER_EPC"))
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("DATE_TIME",
> System.Data.Odbc.OdbcType.VarChar, 255, "DATE_TIME"))
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("PAYLOAD",
> System.Data.Odbc.OdbcType.VarChar, 255, "PAYLOAD"))
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("GTIN_DOMAIN",
> System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_DOMAIN"))
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("GTIN_CLASS",
> System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_CLASS"))
> '
> 'Form1
> '
> Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
> Me.ClientSize = New System.Drawing.Size(608, 398)
> Me.Controls.Add(Me.btnLoad)
> Me.Controls.Add(Me.btnUpdate)
> Me.Controls.Add(Me.DataGrid1)
> Me.Name = "Form1"
> Me.Text = "Form1"
> CType(Me.DsTags1,
> System.ComponentModel.ISupportInitialize).EndInit( )
> CType(Me.DataGrid1,
> System.ComponentModel.ISupportInitialize).EndInit( )
> Me.ResumeLayout(False)
> End Sub
> #End Region
> Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles btnUpdate.Click
> OdbcDataAdapter1.Update(DsTags1)
> MessageBox.Show("Database Updated!")
> End Sub
> Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btnLoad.Click
> OdbcDataAdapter1.Fill(DsTags1)
> MessageBox.Show("Data Table Loaded Successfully!")
> End Sub
> End Class
>
> That's the long and short of it! Appreciate any help.
>
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!

Error 07002 - SQLBindParameter not used for all parameters

Hi, I created a simple VB.NET 2003 application through Visual Studio
that connects to a mysql database and loads a table into a Dataset, and
then displays that table information in a DataGrid on a form for
editing. The table fill works fine, the delete function works fine, but
when I try to update a row, the application fails with the following
error message:
An unhandled exception of type 'System.Data.Odbc.OdbcException' occurred
in system.data.dll
Additional information: System error.
'Data Access VB App.exe': Loaded
'c:\windows\assembly\gac\microsoft.visualbasic\7.0.5000.0__b03f5f7f11d50
a3a\microsoft.visualbasic.dll', No symbols loaded.
Unhandled Exception: System.Data.Odbc.OdbcException: ERROR [07002]
[MySQL][ODBC 3.51 Driver][mysqld-4.0.21-debug]SQLBindParameter n
ot used
for all parameters
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
srcTable)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet)
at Data_Access_VB_App.Form1.btnUpdate_Click(Object sender, EventArgs
e) in C:\Documents and Settings\System Admin\My Documents\Visual Studio
Projects\Data Access VB App\Form1.vb:line 225
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProThe program '[2608] Data Access
VB App.exe' has exited with code 0 (0x0).
c(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&
msg)
at
System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeM
ethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32
reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Data_Access_VB_App.Form1.Main() in C:\Documents and
Settings\System Admin\My Documents\Visual Studio Projects\Data Access VB
App\Form1.vb:line 1
The majority of the code was generated by Visual Studio and based on the
error message it would seem that I have to add SQLBindParameter
statements, but I am not sure the syntax that I should be using. I am
new to VB.NET (coming from Java/J2EE) and haven't been able to come up
with a workable solution after pouring over the MSDN manuals. Here is
the generated code:
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents OdbcDataAdapter1 As
System.Data.Odbc.OdbcDataAdapter
Friend WithEvents OdbcConnection1 As System.Data.Odbc.OdbcConnection
Friend WithEvents DsTags1 As Data_Access_VB_App.dsTags
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents btnUpdate As System.Windows.Forms.Button
Friend WithEvents btnLoad As System.Windows.Forms.Button
Friend WithEvents OdbcDataAdapter2 As
System.Data.Odbc.OdbcDataAdapter
Friend WithEvents OdbcSelectCommand2 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcInsertCommand2 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcConnection2 As System.Data.Odbc.OdbcConnection
Friend WithEvents OdbcDeleteCommand2 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcUpdateCommand2 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcSelectCommand1 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcInsertCommand1 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcDeleteCommand1 As System.Data.Odbc.OdbcCommand
Friend WithEvents OdbcUpdateCommand1 As System.Data.Odbc.OdbcCommand
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.OdbcDataAdapter1 = New System.Data.Odbc.OdbcDataAdapter
Me.OdbcConnection1 = New System.Data.Odbc.OdbcConnection
Me.DsTags1 = New Data_Access_VB_App.dsTags
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.btnUpdate = New System.Windows.Forms.Button
Me.btnLoad = New System.Windows.Forms.Button
Me.OdbcDataAdapter2 = New System.Data.Odbc.OdbcDataAdapter
Me.OdbcDeleteCommand2 = New System.Data.Odbc.OdbcCommand
Me.OdbcConnection2 = New System.Data.Odbc.OdbcConnection
Me.OdbcInsertCommand2 = New System.Data.Odbc.OdbcCommand
Me.OdbcSelectCommand2 = New System.Data.Odbc.OdbcCommand
Me.OdbcUpdateCommand2 = New System.Data.Odbc.OdbcCommand
Me.OdbcSelectCommand1 = New System.Data.Odbc.OdbcCommand
Me.OdbcInsertCommand1 = New System.Data.Odbc.OdbcCommand
Me.OdbcDeleteCommand1 = New System.Data.Odbc.OdbcCommand
Me.OdbcUpdateCommand1 = New System.Data.Odbc.OdbcCommand
CType(Me.DsTags1,
System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DataGrid1,
System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'OdbcDataAdapter1
'
Me.OdbcDataAdapter1.DeleteCommand = Me.OdbcDeleteCommand1
Me.OdbcDataAdapter1.InsertCommand = Me.OdbcInsertCommand1
Me.OdbcDataAdapter1.SelectCommand = Me.OdbcSelectCommand1
Me.OdbcDataAdapter1.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "epctag", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("ID", "ID"), New
System.Data.Common.DataColumnMapping("OBJECT_EPC", "OBJECT_EPC"), New
System.Data.Common.DataColumnMapping("READER_EPC", "READER_EPC"), New
System.Data.Common.DataColumnMapping("DATE_TIME", "DATE_TIME"), New
System.Data.Common.DataColumnMapping("PAYLOAD", "PAYLOAD"), New
System.Data.Common.DataColumnMapping("GTIN_DOMAIN", "GTIN_DOMAIN"), New
System.Data.Common.DataColumnMapping("GTIN_CLASS", "GTIN_CLASS")})})
Me.OdbcDataAdapter1.UpdateCommand = Me.OdbcUpdateCommand1
'
'OdbcConnection1
'
Me.OdbcConnection1.ConnectionString =
" STMT=;OPTION=3;DSN=EPCThingsNET;UID=root
;SOCKET=;DESC=MySQL ODBC 3.51
Driver DSN;" & _
" DATABASE=thingsnet;SERVER=localhost;PORT
=3306"
'
'DsTags1
'
Me.DsTags1.DataSetName = "dsTags"
Me.DsTags1.Locale = New
System.Globalization.CultureInfo("en-US")
'
'DataGrid1
'
Me.DataGrid1.DataMember = "epctag"
Me.DataGrid1.DataSource = Me.DsTags1
Me.DataGrid1.HeaderForeColor =
System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(8, 128)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(584, 264)
Me.DataGrid1.TabIndex = 0
'
'btnUpdate
'
Me.btnUpdate.Location = New System.Drawing.Point(224, 48)
Me.btnUpdate.Name = "btnUpdate"
Me.btnUpdate.Size = New System.Drawing.Size(152, 23)
Me.btnUpdate.TabIndex = 1
Me.btnUpdate.Text = "Save Changes in Database"
'
'btnLoad
'
Me.btnLoad.Location = New System.Drawing.Point(56, 40)
Me.btnLoad.Name = "btnLoad"
Me.btnLoad.TabIndex = 2
Me.btnLoad.Text = "Load Data"
'
'OdbcSelectCommand1
'
Me.OdbcSelectCommand1.CommandText = "SELECT ID, OBJECT_EPC,
READER_EPC, DATE_TIME, PAYLOAD, GTIN_DOMAIN, GTIN_CLASS FR" & _
"OM epctag"
Me.OdbcSelectCommand1.Connection = Me.OdbcConnection1
'
'OdbcInsertCommand1
'
Me.OdbcInsertCommand1.CommandText = "INSERT INTO epctag(ID,
OBJECT_EPC, READER_EPC, DATE_TIME, PAYLOAD, GTIN_DOMAIN, G" & _
"TIN_CLASS) VALUES (?, ?, ?, ?, ?, ?, ?)"
Me.OdbcInsertCommand1.Connection = Me.OdbcConnection1
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("ID", System.Data.Odbc.OdbcType.BigInt,
0, "ID"))
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("OBJECT_EPC",
System.Data.Odbc.OdbcType.VarChar, 255, "OBJECT_EPC"))
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("READER_EPC",
System.Data.Odbc.OdbcType.VarChar, 255, "READER_EPC"))
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("DATE_TIME",
System.Data.Odbc.OdbcType.VarChar, 255, "DATE_TIME"))
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("PAYLOAD",
System.Data.Odbc.OdbcType.VarChar, 255, "PAYLOAD"))
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("GTIN_DOMAIN",
System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_DOMAIN"))
Me.OdbcInsertCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("GTIN_CLASS",
System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_CLASS"))
'
'OdbcDeleteCommand1
'
Me.OdbcDeleteCommand1.CommandText = "DELETE FROM epctag WHERE
(ID = ?)"
Me.OdbcDeleteCommand1.Connection = Me.OdbcConnection1
Me.OdbcDeleteCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("ID", System.Data.Odbc.OdbcType.BigInt,
0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ID", System.Data.DataRowVersion.Original, Nothing))
'
'OdbcUpdateCommand1
'
Me.OdbcUpdateCommand1.CommandText = "UPDATE ecptag SET ID = ?,
OBJECT_EPC = ?, READER_EPC = ?, DATE_TIME = ?, PAYLOAD " & _
"= ?, GTIN_DOMAIN = ?, GTIN_CLASS = ? WHERE (ID = ?)"
Me.OdbcUpdateCommand1.Connection = Me.OdbcConnection1
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("ID", System.Data.Odbc.OdbcType.BigInt,
0, "ID"))
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("OBJECT_EPC",
System.Data.Odbc.OdbcType.VarChar, 255, "OBJECT_EPC"))
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("READER_EPC",
System.Data.Odbc.OdbcType.VarChar, 255, "READER_EPC"))
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("DATE_TIME",
System.Data.Odbc.OdbcType.VarChar, 255, "DATE_TIME"))
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("PAYLOAD",
System.Data.Odbc.OdbcType.VarChar, 255, "PAYLOAD"))
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("GTIN_DOMAIN",
System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_DOMAIN"))
Me.OdbcUpdateCommand1.Parameters.Add(New
System.Data.Odbc.OdbcParameter("GTIN_CLASS",
System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_CLASS"))
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(608, 398)
Me.Controls.Add(Me.btnLoad)
Me.Controls.Add(Me.btnUpdate)
Me.Controls.Add(Me.DataGrid1)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.DsTags1,
System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DataGrid1,
System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnUpdate.Click
OdbcDataAdapter1.Update(DsTags1)
MessageBox.Show("Database Updated!")
End Sub
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLoad.Click
OdbcDataAdapter1.Fill(DsTags1)
MessageBox.Show("Data Table Loaded Successfully!")
End Sub
End Class
That's the long and short of it! Appreciate any help.
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!You aren't binding the correct number of parameters for the update command.
You are expecting ODBC to use the "ID" parameter twice, but that wont
happen. You have to bind an OdbcParameter object for each '?'. If you have
8 parameter markers, you must bind 8 parameters. You are only binding 7
parameters.
Brannon
"Mikey G" <nospam@.devdex.com> wrote in message
news:#M02y8hsEHA.2808@.TK2MSFTNGP14.phx.gbl...
> Hi, I created a simple VB.NET 2003 application through Visual Studio
> that connects to a mysql database and loads a table into a Dataset, and
> then displays that table information in a DataGrid on a form for
> editing. The table fill works fine, the delete function works fine, but
> when I try to update a row, the application fails with the following
> error message:
> An unhandled exception of type 'System.Data.Odbc.OdbcException' occurred
> in system.data.dll
> Additional information: System error.
> 'Data Access VB App.exe': Loaded
> 'c:\windows\assembly\gac\microsoft.visualbasic\7.0.5000.0__b03f5f7f11d50
> a3a\microsoft.visualbasic.dll', No symbols loaded.
> Unhandled Exception: System.Data.Odbc.OdbcException: ERROR [07002]
> [MySQL][ODBC 3.51 Driver][mysqld-4.0.21-debug]SQLBindParameter
not used
> for all parameters
> at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
> DataTableMapping tableMapping)
> at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
> srcTable)
> at System.Data.Common.DbDataAdapter.Update(DataSet dataSet)
> at Data_Access_VB_App.Form1.btnUpdate_Click(Object sender, EventArgs
> e) in C:\Documents and Settings\System Admin\My Documents\Visual Studio
> Projects\Data Access VB App\Form1.vb:line 225
> at System.Windows.Forms.Control.OnClick(EventArgs e)
> at System.Windows.Forms.Button.OnClick(EventArgs e)
> at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
> at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
> button, Int32 clicks)
> at System.Windows.Forms.Control.WndProc(Message& m)
> at System.Windows.Forms.ButtonBase.WndProc(Message& m)
> at System.Windows.Forms.Button.WndProThe program '[2608] Data Acces
s
> VB App.exe' has exited with code 0 (0x0).
> c(Message& m)
> at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
> at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
> at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
> Int32 msg, IntPtr wparam, IntPtr lparam)
> at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&
> msg)
> at
> System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeM
> ethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32
> reason, Int32 pvLoopData)
> at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32
> reason, ApplicationContext context)
> at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
> ApplicationContext context)
> at System.Windows.Forms.Application.Run(Form mainForm)
> at Data_Access_VB_App.Form1.Main() in C:\Documents and
> Settings\System Admin\My Documents\Visual Studio Projects\Data Access VB
> App\Form1.vb:line 1
>
> The majority of the code was generated by Visual Studio and based on the
> error message it would seem that I have to add SQLBindParameter
> statements, but I am not sure the syntax that I should be using. I am
> new to VB.NET (coming from Java/J2EE) and haven't been able to come up
> with a workable solution after pouring over the MSDN manuals. Here is
> the generated code:
>
> Public Class Form1
> Inherits System.Windows.Forms.Form
> #Region " Windows Form Designer generated code "
> Public Sub New()
> MyBase.New()
> 'This call is required by the Windows Form Designer.
> InitializeComponent()
> 'Add any initialization after the InitializeComponent() call
> End Sub
> 'Form overrides dispose to clean up the component list.
> Protected Overloads Overrides Sub Dispose(ByVal disposing As
> Boolean)
> If disposing Then
> If Not (components Is Nothing) Then
> components.Dispose()
> End If
> End If
> MyBase.Dispose(disposing)
> End Sub
> 'NOTE: The following procedure is required by the Windows Form Designer
> 'It can be modified using the Windows Form Designer.
> 'Do not modify it using the code editor.
> Friend WithEvents OdbcDataAdapter1 As
> System.Data.Odbc.OdbcDataAdapter
> Friend WithEvents OdbcConnection1 As System.Data.Odbc.OdbcConnection
> Friend WithEvents DsTags1 As Data_Access_VB_App.dsTags
> Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
> Friend WithEvents btnUpdate As System.Windows.Forms.Button
> Friend WithEvents btnLoad As System.Windows.Forms.Button
> Friend WithEvents OdbcDataAdapter2 As
> System.Data.Odbc.OdbcDataAdapter
> Friend WithEvents OdbcSelectCommand2 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcInsertCommand2 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcConnection2 As System.Data.Odbc.OdbcConnection
> Friend WithEvents OdbcDeleteCommand2 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcUpdateCommand2 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcSelectCommand1 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcInsertCommand1 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcDeleteCommand1 As System.Data.Odbc.OdbcCommand
> Friend WithEvents OdbcUpdateCommand1 As System.Data.Odbc.OdbcCommand
> <System.Diagnostics.DebuggerStepThrough()> Private Sub
> InitializeComponent()
> Me.OdbcDataAdapter1 = New System.Data.Odbc.OdbcDataAdapter
> Me.OdbcConnection1 = New System.Data.Odbc.OdbcConnection
> Me.DsTags1 = New Data_Access_VB_App.dsTags
> Me.DataGrid1 = New System.Windows.Forms.DataGrid
> Me.btnUpdate = New System.Windows.Forms.Button
> Me.btnLoad = New System.Windows.Forms.Button
> Me.OdbcDataAdapter2 = New System.Data.Odbc.OdbcDataAdapter
> Me.OdbcDeleteCommand2 = New System.Data.Odbc.OdbcCommand
> Me.OdbcConnection2 = New System.Data.Odbc.OdbcConnection
> Me.OdbcInsertCommand2 = New System.Data.Odbc.OdbcCommand
> Me.OdbcSelectCommand2 = New System.Data.Odbc.OdbcCommand
> Me.OdbcUpdateCommand2 = New System.Data.Odbc.OdbcCommand
> Me.OdbcSelectCommand1 = New System.Data.Odbc.OdbcCommand
> Me.OdbcInsertCommand1 = New System.Data.Odbc.OdbcCommand
> Me.OdbcDeleteCommand1 = New System.Data.Odbc.OdbcCommand
> Me.OdbcUpdateCommand1 = New System.Data.Odbc.OdbcCommand
> CType(Me.DsTags1,
> System.ComponentModel.ISupportInitialize).BeginInit()
> CType(Me.DataGrid1,
> System.ComponentModel.ISupportInitialize).BeginInit()
> Me.SuspendLayout()
> '
> 'OdbcDataAdapter1
> '
> Me.OdbcDataAdapter1.DeleteCommand = Me.OdbcDeleteCommand1
> Me.OdbcDataAdapter1.InsertCommand = Me.OdbcInsertCommand1
> Me.OdbcDataAdapter1.SelectCommand = Me.OdbcSelectCommand1
> Me.OdbcDataAdapter1.TableMappings.AddRange(New
> System.Data.Common.DataTableMapping() {New
> System.Data.Common.DataTableMapping("Table", "epctag", New
> System.Data.Common.DataColumnMapping() {New
> System.Data.Common.DataColumnMapping("ID", "ID"), New
> System.Data.Common.DataColumnMapping("OBJECT_EPC", "OBJECT_EPC"), New
> System.Data.Common.DataColumnMapping("READER_EPC", "READER_EPC"), New
> System.Data.Common.DataColumnMapping("DATE_TIME", "DATE_TIME"), New
> System.Data.Common.DataColumnMapping("PAYLOAD", "PAYLOAD"), New
> System.Data.Common.DataColumnMapping("GTIN_DOMAIN", "GTIN_DOMAIN"), New
> System.Data.Common.DataColumnMapping("GTIN_CLASS", "GTIN_CLASS")})})
> Me.OdbcDataAdapter1.UpdateCommand = Me.OdbcUpdateCommand1
> '
> 'OdbcConnection1
> '
> Me.OdbcConnection1.ConnectionString =
> " STMT=;OPTION=3;DSN=EPCThingsNET;UID=root
;SOCKET=;DESC=MySQL ODBC 3.51
> Driver DSN;" & _
> " DATABASE=thingsnet;SERVER=localhost;PORT
=3306"
> '
> 'DsTags1
> '
> Me.DsTags1.DataSetName = "dsTags"
> Me.DsTags1.Locale = New
> System.Globalization.CultureInfo("en-US")
> '
> 'DataGrid1
> '
> Me.DataGrid1.DataMember = "epctag"
> Me.DataGrid1.DataSource = Me.DsTags1
> Me.DataGrid1.HeaderForeColor =
> System.Drawing.SystemColors.ControlText
> Me.DataGrid1.Location = New System.Drawing.Point(8, 128)
> Me.DataGrid1.Name = "DataGrid1"
> Me.DataGrid1.Size = New System.Drawing.Size(584, 264)
> Me.DataGrid1.TabIndex = 0
> '
> 'btnUpdate
> '
> Me.btnUpdate.Location = New System.Drawing.Point(224, 48)
> Me.btnUpdate.Name = "btnUpdate"
> Me.btnUpdate.Size = New System.Drawing.Size(152, 23)
> Me.btnUpdate.TabIndex = 1
> Me.btnUpdate.Text = "Save Changes in Database"
> '
> 'btnLoad
> '
> Me.btnLoad.Location = New System.Drawing.Point(56, 40)
> Me.btnLoad.Name = "btnLoad"
> Me.btnLoad.TabIndex = 2
> Me.btnLoad.Text = "Load Data"
> '
> 'OdbcSelectCommand1
> '
> Me.OdbcSelectCommand1.CommandText = "SELECT ID, OBJECT_EPC,
> READER_EPC, DATE_TIME, PAYLOAD, GTIN_DOMAIN, GTIN_CLASS FR" & _
> "OM epctag"
> Me.OdbcSelectCommand1.Connection = Me.OdbcConnection1
> '
> 'OdbcInsertCommand1
> '
> Me.OdbcInsertCommand1.CommandText = "INSERT INTO epctag(ID,
> OBJECT_EPC, READER_EPC, DATE_TIME, PAYLOAD, GTIN_DOMAIN, G" & _
> "TIN_CLASS) VALUES (?, ?, ?, ?, ?, ?, ?)"
> Me.OdbcInsertCommand1.Connection = Me.OdbcConnection1
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("ID", System.Data.Odbc.OdbcType.BigInt,
> 0, "ID"))
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("OBJECT_EPC",
> System.Data.Odbc.OdbcType.VarChar, 255, "OBJECT_EPC"))
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("READER_EPC",
> System.Data.Odbc.OdbcType.VarChar, 255, "READER_EPC"))
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("DATE_TIME",
> System.Data.Odbc.OdbcType.VarChar, 255, "DATE_TIME"))
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("PAYLOAD",
> System.Data.Odbc.OdbcType.VarChar, 255, "PAYLOAD"))
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("GTIN_DOMAIN",
> System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_DOMAIN"))
> Me.OdbcInsertCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("GTIN_CLASS",
> System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_CLASS"))
> '
> 'OdbcDeleteCommand1
> '
> Me.OdbcDeleteCommand1.CommandText = "DELETE FROM epctag WHERE
> (ID = ?)"
> Me.OdbcDeleteCommand1.Connection = Me.OdbcConnection1
> Me.OdbcDeleteCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("ID", System.Data.Odbc.OdbcType.BigInt,
> 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
> Byte), "ID", System.Data.DataRowVersion.Original, Nothing))
> '
> 'OdbcUpdateCommand1
> '
> Me.OdbcUpdateCommand1.CommandText = "UPDATE ecptag SET ID = ?,
> OBJECT_EPC = ?, READER_EPC = ?, DATE_TIME = ?, PAYLOAD " & _
> "= ?, GTIN_DOMAIN = ?, GTIN_CLASS = ? WHERE (ID = ?)"
> Me.OdbcUpdateCommand1.Connection = Me.OdbcConnection1
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("ID", System.Data.Odbc.OdbcType.BigInt,
> 0, "ID"))
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("OBJECT_EPC",
> System.Data.Odbc.OdbcType.VarChar, 255, "OBJECT_EPC"))
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("READER_EPC",
> System.Data.Odbc.OdbcType.VarChar, 255, "READER_EPC"))
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("DATE_TIME",
> System.Data.Odbc.OdbcType.VarChar, 255, "DATE_TIME"))
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("PAYLOAD",
> System.Data.Odbc.OdbcType.VarChar, 255, "PAYLOAD"))
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("GTIN_DOMAIN",
> System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_DOMAIN"))
> Me.OdbcUpdateCommand1.Parameters.Add(New
> System.Data.Odbc.OdbcParameter("GTIN_CLASS",
> System.Data.Odbc.OdbcType.VarChar, 255, "GTIN_CLASS"))
> '
> 'Form1
> '
> Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
> Me.ClientSize = New System.Drawing.Size(608, 398)
> Me.Controls.Add(Me.btnLoad)
> Me.Controls.Add(Me.btnUpdate)
> Me.Controls.Add(Me.DataGrid1)
> Me.Name = "Form1"
> Me.Text = "Form1"
> CType(Me.DsTags1,
> System.ComponentModel.ISupportInitialize).EndInit()
> CType(Me.DataGrid1,
> System.ComponentModel.ISupportInitialize).EndInit()
> Me.ResumeLayout(False)
> End Sub
> #End Region
> Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles btnUpdate.Click
> OdbcDataAdapter1.Update(DsTags1)
> MessageBox.Show("Database Updated!")
> End Sub
> Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btnLoad.Click
> OdbcDataAdapter1.Fill(DsTags1)
> MessageBox.Show("Data Table Loaded Successfully!")
> End Sub
> End Class
>
> That's the long and short of it! Appreciate any help.
>
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!

Sunday, February 26, 2012

Error "The OLE DB provider "MSDASQL" has not been registered." on SQL 2005 6

Hi,
I am trying to create a linked server from SQL server 2005 (64bit) to IB 7.5 database.

I installed the driver for IB on SQL box and created a System DNS (using
%SystemRoot%\SysWOW64\odbcad32.exe), tested the connection fine.

Now, on SQL Management Studio, created a linked server to use the System DSN,
sp_addlinkedserver 'MyLinkedSrv', ' ', 'MSDASQL', 'MySYSDNS' -- went fine.

Then ran the openquery,
select * from OPENQUERY(MyLinkedSrv, 'select * from services')

An error msg returned fro the openquery.
The OLE DB provider "MSDASQL" has not been registered.

What am I missing here? I tried with "Native SQL Client" instead MSDASQL but it returns me invaild parameters...


Any advice on this would be aprreciated.

Regards,
Sunny

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=396615&SiteID=1

HTH

Friday, February 24, 2012

Error "Physical Databasew not found" :-(

Hi out there,

I've created some Crystal Reports in a VB Application. Everything works fine on my comnputer.
The application is installed on several other clients, and on some other machines the reoprts do not work, CR generates an error "Physical Database not found".
On the Crystal Reports homepage several articles are given to solve this poblem, but unfortunately nothing helps.

I've done the foolowing things trying to fix the problem:
- distributing the files given in the knowledgebase with the setup
- Unsetting the "Use indexes for speed" option in the CR object
- Setting the "discard saved data" option in the CR Object

Is there any other thing I can do to try to make the CR work?

System-Environment is CR85, database Background is SQL-Server2k, ADO-Version is 2.8"Physical Database not found"

Obviously ur link 2 Db is broken. Did u check SQL client configurations. U should be using ODBC like connection, if u give a direct link to Db in CR, u should expect this problem.|||Hi Janitha,

no it's quite clear that this can't be the problem as the reports are running correctly on some machines. As the database is on sql-Server (and I'm using the sql-Server-driver, no odbc), if the connection would not be initialized correctly the reports would not run on any client.|||Hi out there,

seems that it is a network (and possibly permission of user) problem.
The setup referred to a folder on the intranet of the company, where the app was located. When I changed the link in the setup back to a local installation, everything works :-)

Sunday, February 19, 2012

Error - procedure expects parameter, which was not supplied

Hi,

I created a stored procedure in the sql server. I try to insert a record from the aspx page. But I keep getting this error,
"procedure expects parameter <@.firstname>, which was not supplied". This is what I am doing.

cmd.CommandText = "proc_insertuser";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@.firstname", SqlDbType.VarChar, 50);
cmd.Parameters["@.firstname"].Value = txtFirstName.Text
...other parameters

I checked the parameter names, it matches correctly. The parameter does get added to the collection. I checked it using cmd.Parameters.Contains("@.firstname") and the value is also correct. Using query analyzer I executed the procedure, I am able to insert a record.

Can anyone tell me what could be the problem.
TAICan you use SQL Profiler? Perhaps that will help diagnose the problem. Is there some other parameter that is missing and being mis-reported?|||if you are using VB.NET I would try replacing your brackets surrounding your parameter name w/ parenthesis instead.

 cmd.Parameters("@.firstname").Value = txtFirstName.Text

HTH

Sandy

Error - Attempted to read or write protected memory

Hi,

I am back with one more problem..

I have created few reports using SSRS 2005. I am using Oracle database in Data Source to fetch my data. It is working fine and showing me report correctly. But after running the report 8 to 10 times, it starts giving me Memory error. To get rid of that, I need to recycle (stop-start) ReportingService from IIS.

I am exactly getting following error...

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

I am not getting the actual problem, why is it giving memory error only after running few times? Please let me know if anyone facing same problem or knowing the solution for the problem.

Thanks,

HMaheta

Dear HMaheta,

Check the DTC (Distributed Transaction Coordinator) service. It should be set up to to start automatically.

HTH,

Suprotim Agarwal

|||

Hi Suprotim,

Thanks for your reply.

I checked for the DTC. It is running on the server and also marked for auto start up.

Is there any other thing, which I am missing?

Thanks,

HMaheta

ERROR - "The underlying connection was closed"

We are running Reporting Services on an SBS 2003 server and have created a
WinForms application that will print reports from RS. Everything works great
from the SBS server but when I run the application from another machine on
the same domain I get the following error: "The underlying connection was
closed: Unable to connect to the remote server."
We're not using SSL or proxies.
Does anyone have any idea what might be causing this problem? Any help would
be greatly appreciated!"Robert" <Robert@.discussions.microsoft.com> wrote in message
news:61AD6244-FDD6-43F0-A5C9-277F269128E2@.microsoft.com...
> We are running Reporting Services on an SBS 2003 server and have created a
> WinForms application that will print reports from RS. Everything works
> great
> from the SBS server but when I run the application from another machine on
> the same domain I get the following error: "The underlying connection was
> closed: Unable to connect to the remote server."
> We're not using SSL or proxies.
> Does anyone have any idea what might be causing this problem? Any help
> would
> be greatly appreciated!
Is this a web service call? I've found a very simple way to reduce 99.9% of
these errors with web services is to place the initial web service call in a
try...catch block. If it fails, immediately try the same web service call
again. That usually fixes it.
HTH,
Mike Rodriguez