Hello!
Thank you for your answer
I try to explain better
I am working with a asp net 2 project and a web custom control.
I find a lot of similar cases on internet:
look at http://forums.asp.net/thread/1305510.aspx, it's quiet similar to
mine
The problem happens ONLY When the VS put the query text on resx file, (as
you can see on my example it's happen with Me.sqlInsertCommand1.)
it seems that the command
Dim resources As System.ComponentModel.ComponentResourceManager = New
System.ComponentModel.ComponentResourceManager(GetType(WebUserControl))
is does not work properly.
Thank you for you help
Example:
Partial Class WebUserControl
Inherits System.Web.UI.UserControl
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New
System.ComponentModel.ComponentResourceManager(GetType(WebUserControl))
Me.sqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.sqlInsertCommand1 = New System.Data.SqlClient.SqlCommand
Me.sqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand
Me.sqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand
Me.sqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter
Me.sqlConnection2 = New System.Data.SqlClient.SqlConnection
'
'sqlSelectCommand1
'
Me.sqlSelectCommand1.CommandText = "SELECT id, nome, cognome, telefono1,
telefono2, email, note, datainserimento" &
Global.Microsoft.VisualBasic.ChrW(13) &
Global.Microsoft.VisualBasic.ChrW(10) & "FROM anagrafica_web"
Me.sqlSelectCommand1.Connection = Me.sqlConnection2
'
'sqlInsertCommand1
'
Me.sqlInsertCommand1.CommandText =
resources.GetString("sqlInsertCommand1.CommandText")
Me.sqlInsertCommand1.Connection = Me.sqlConnection2
Me.sqlInsertCommand1.Parameters.AddRange(New
System.Data.SqlClient.SqlParameter() {New
System.Data.SqlClient.SqlParameter("@nome", System.Data.SqlDbType.VarChar,
0, "nome"), New System.Data.SqlClient.SqlParameter("@cognome",
System.Data.SqlDbType.VarChar, 0, "cognome"), New
System.Data.SqlClient.SqlParameter("@telefono1",
System.Data.SqlDbType.VarChar, 0, "telefono1"), New
System.Data.SqlClient.SqlParameter("@telefono2",
System.Data.SqlDbType.VarChar, 0, "telefono2"), New
System.Data.SqlClient.SqlParameter("@email", System.Data.SqlDbType.VarChar,
0, "email"), New System.Data.SqlClient.SqlParameter("@note",
System.Data.SqlDbType.Text, 0, "note"), New
System.Data.SqlClient.SqlParameter("@datainserimento",
System.Data.SqlDbType.SmallDateTime, 0, "datainserimento")})
'
'sqlUpdateCommand1
'
Me.sqlUpdateCommand1.CommandText =
resources.GetString("sqlUpdateCommand1.CommandText")
Me.sqlUpdateCommand1.Connection = Me.sqlConnection2
Me.sqlUpdateCommand1.Parameters.AddRange(New
System.Data.SqlClient.SqlParameter() {New
System.Data.SqlClient.SqlParameter("@nome", System.Data.SqlDbType.VarChar,
0, "nome"), New System.Data.SqlClient.SqlParameter("@cognome",
System.Data.SqlDbType.VarChar, 0, "cognome"), New
System.Data.SqlClient.SqlParameter("@telefono1",
System.Data.SqlDbType.VarChar, 0, "telefono1"), New
System.Data.SqlClient.SqlParameter("@telefono2",
System.Data.SqlDbType.VarChar, 0, "telefono2"), New
System.Data.SqlClient.SqlParameter("@email", System.Data.SqlDbType.VarChar,
0, "email"), New System.Data.SqlClient.SqlParameter("@note",
System.Data.SqlDbType.Text, 0, "note"), New
System.Data.SqlClient.SqlParameter("@datainserimento",
System.Data.SqlDbType.SmallDateTime, 0, "datainserimento"), New
System.Data.SqlClient.SqlParameter("@Original_id",
System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, False,
CType(0, Byte), CType(0, Byte), "id", System.Data.DataRowVersion.Original,
Nothing), New System.Data.SqlClient.SqlParameter("@id",
System.Data.SqlDbType.Int, 4, "id")})
'
'sqlDeleteCommand1
'
Me.sqlDeleteCommand1.CommandText = "DELETE FROM [anagrafica_web] WHERE
(([id] = @Original_id))"
Me.sqlDeleteCommand1.Connection = Me.sqlConnection2
Me.sqlDeleteCommand1.Parameters.AddRange(New
System.Data.SqlClient.SqlParameter() {New
System.Data.SqlClient.SqlParameter("@Original_id",
System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, False,
CType(0, Byte), CType(0, Byte), "id", System.Data.DataRowVersion.Original,
Nothing)})
'
'sqlDataAdapter1
'
Me.sqlDataAdapter1.DeleteCommand = Me.sqlDeleteCommand1
Me.sqlDataAdapter1.InsertCommand = Me.sqlInsertCommand1
Me.sqlDataAdapter1.SelectCommand = Me.sqlSelectCommand1
Me.sqlDataAdapter1.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "anagrafica_web", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("id", "id"), New
System.Data.Common.DataColumnMapping("nome", "nome"), New
System.Data.Common.DataColumnMapping("cognome", "cognome"), New
System.Data.Common.DataColumnMapping("telefono1", "telefono1"), New
System.Data.Common.DataColumnMapping("telefono2", "telefono2"), New
System.Data.Common.DataColumnMapping("email", "email"), New
System.Data.Common.DataColumnMapping("note", "note"), New
System.Data.Common.DataColumnMapping("datainserimento",
"datainserimento")})})
Me.sqlDataAdapter1.UpdateCommand = Me.sqlUpdateCommand1
'
'sqlConnection2
'
Me.sqlConnection2.ConnectionString = "Data Source=m2\sql2k5;Initial
Catalog=planny;Integrated Security=True"
Me.sqlConnection2.FireInfoMessageEventOnUserErrors = False
End Sub
Private WithEvents sqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter
Private WithEvents sqlDeleteCommand1 As System.Data.SqlClient.SqlCommand
Private WithEvents sqlUpdateCommand1 As System.Data.SqlClient.SqlCommand
Private WithEvents sqlInsertCommand1 As System.Data.SqlClient.SqlCommand
Private WithEvents sqlConnection2 As System.Data.SqlClient.SqlConnection
Private WithEvents sqlSelectCommand1 As System.Data.SqlClient.SqlCommand
> Hi Alessandro,
> Sorry for the late reply.
[quoted text clipped - 26 lines]
> Sincerely,
> Wen Yuan
WenYuan Wang - 08 Mar 2007 07:14 GMT
Hi Alessandro,
Thanks for your information.
According to the error message posted in the
http://forums.asp.net/thread/1305510.aspx ( By the way, would you please
post your exact Error message for me?)
"Could not find any resources appropriate for the specified culture or the
neutral culture. Make sure "SDTR.reconcile_month.resources" was correctly
embedded or linked into assembly "App_Web_gjoeff4z" at compile time, or
that all the satellite assemblies required are loadable and fully signed."
It seem like asp.net 2.0 couldn't read the resource file. Have you embedded
Resource?
Please do the following steps:
1.Select your .resx file.
2.Select "Embedded Resource" in Build Action Properties list box.
If this method doesn't work for you, could you please provide some
reproduce steps for us if it is possible ?
In fact, I have created a ASP.net 1.1 web project and added a web user
control included SQLDataAdapter, SQLDataConnection ... updated this project
to ASP.net 2.0 using VS 2005 wizard. But I run the project without any
error message.
Additionally, I open the web user control in design mode. But I cannot edit
the SQLDataAdpter on the design mode (There is no SQLDataAdpter on the
design mode). I'm not sure how to achieve this.
(It works fine in 2005, but on some pages, when you edit an SqlCommand for
example, all the SQL strings are moved from the codebehind to a resx file
automatically by VS.NET 2005) in the
http://forums.asp.net/thread/1305510.aspx
Have a great day.
Sincerely,
Wen Yuan