Archive
MySQL : The user specified as a definer (‘root’@’%’) does not exist
This error occurs when exporting views/triggers/procedures from one database or server to another as the user that created that object no longer exists.
So here are the solutions:
- Change DEFINERCreate the missing user
- Create the missing user
or simply run following query
grant all on *.* to ‘root’@’%’ identified by ‘password’ with grant option;
Hope it helps.
MySQL : The host localhost does not support SSL connections
When I moved database MySql.Data 7.0.7 to 8.0.8. I got following error
The host localhost does not support SSL connections.
So, here is the solution for this error ,Just add SslMode=none in connection string
server=localhost;user id=roor;password=xyz;persistsecurityinfo=True;port=123;database=TestDB; SslMode=none
Hope it helps !
How to fix function is ambiguous in the namespace ‘system’ compiler error
When you are upgrading your project framework its possible that old version of DLL reference still exists , to remove that follow the below steps
-Open Object Explorer in Visual Studio
-Find that function
-Find the function/dll which has old reference and delete it
Hope it helps!
Call Repeater ItemCommand event manually from outside the repeater
Following is the code to call repeater item command event manually
Private Sub btnTest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTest.Click
For i = 0 To rptPlayers.Items.Count – 1
Dim tItem As RepeaterItem = rptPlayers.Items(i)
Dim tButton As ImageButton = ptPlayers.Items(i).FindControl(“imgAdd”)
Dim tEvents As New System.Web.UI.WebControls.CommandEventArgs(tButton.CommandName, tButton.CommandArgument)
Dim rpt As New RepeaterCommandEventArgs(tItem, tButton, tEvents)
rptPlayers_ItemCommand(tButton, rpt)
Next
End Sub
Telerik ORM : Row not found: GenericOID@ OptimisticVerificationException
This kind of error occurred When DataAccess tries to update the row in the database which has the original values for the fields that have changed.
The reason the update fails is that the artificial columns added at runtime are nullable but the CLR property which these columns are mapped to are all non-nullable. Ex – bit column is mapped to Boolean CLR property.
The generated UPDATE statement tries to find a row with the CLR default value i.e 0 but the value in the column is NULL.
I have updated the method that maps the artificial properties as follows –
var propType = Type.GetType(property.PropertyType);
if(propType.IsValueType)
{
propType = GetNullableType(propType);
}
var primitivePropertyConfiguration = myConfig.HasArtificialPrimitiveProperty(property.PropertyName,propType).HasFieldName(property.PropertyName);
Here I check if the Type of the field is a value type and if it is, then I create a nullable CLR type instead of the non-nullable type.
The helper method used is as below
public static Type GetNullableType(Type type)
{
if (type.IsValueType)
{
Type nullable = typeof(Nullable);
return nullable.MakeGenericType(new[] { type });
}
return type;
}
Hope this help !
EXT.NET : Getting selected RadioGroup value through inputValue
How to get selected value from RadioGroup in EXT.NET
Consider following sample code
On the server side I would like to be able to do something similar to this:
var value = typeRadioGroup.CheckedItems[0].InputValue;
to get the selected value directly and proceed with the code instead of calling e.g.
if (dailyRadio.Checked)
// do something
else if (weeklyRadioChecked)
// something else
Hope This help !
Data Annotations – ForeignKey Attribute in EF 6 & EF Core
The ForeignKey attribute is used to configure a foreign key in the relationship between two entities in EF 6 and EF Core. It overrides the default conventions. As per the default convention, EF makes a property as foreign key property when its name matches with the primary key property of a related entity.
ForeignKey Signature: [ForeignKey(name string)]
- name: Name of the associated navigation property or the name of the associated foreign key(s).
Consider the following example of one-to-many relationship among entities.
public class Student { public int StudentID { get; set; } public string StudentName { get; set; } //Foreign key for Standard public int StandardId { get; set; } public Standard Standard { get; set; } } public class Standard { public int StandardId { get; set; } public string StandardName { get; set; } public ICollection<Student> Students { get; set; } }
The above example depicts a one-to-many relationship between Student
and Standard
entities. To represent this relationship, the Student
class includes a property StandardId
with reference property Standard
and Standard
entity class includes collection navigation property Students
. A property name StandardId
in Student
entity matches with the primary key property of Standard
entity, so StandardId
in Student
entity will automatically become a foreign key property and corresponding column in the db table will also be a foreign key column as shown below.

The [ForeignKey]
attribute overrides the default convention for a foreign key It allows us to specify the foreign key property in the dependent entity whose name does not match with the primary key property of the principal entity.
The [ForeignKey(name)]
attribute can be applied in three ways:
[ForeignKey(NavigationPropertyName)]
on the foreign key scalar property in the dependent entity[ForeignKey(ForeignKeyPropertyName)]
on the related reference navigation property in the dependent entity[ForeignKey(ForeignKeyPropertyName)]
on the navigation property in the principal entity
[ForeignKey] on the foreign key property in the dependent entity:
The [ForeignKey]
on the foreign key property in the dependent entity and the related navigation property name can be specified as a parameter as shown below.
public class Student { public int StudentID { get; set; } public string StudentName { get; set; } [ForeignKey("Standard")] public int StandardRefId { get; set; } public Standard Standard { get; set; } } public class Standard { public int StandardId { get; set; } public string StandardName { get; set; } public ICollection<Student> Students { get; set; } }
In the above example, the [ForeignKey]
attribute is applied on the StandardRefId
and specified the name of the navigation property Standard
. This will create the foreign key column named StandardRefId
in the Students
table, preventing the generation of a StandardId
column in the database.

[ForeignKey] on the navigation property in the dependent entity:
The [ForeignKey]
attribute can be applied to the navigation property and the related foreign key property name can be specified as shown below.
public class Student { public int StudentID { get; set; } public string StudentName { get; set; } public int StandardRefId { get; set; } [ForeignKey("StandardRefId")] public Standard Standard { get; set; } } public class Standard { public int StandardId { get; set; } public string StandardName { get; set; } public ICollection<Student> Students { get; set; } }
In the above example, the [ForeignKey]
attribute is applied on the Standard
navigation property and specified the name of the foreign key property StandardRefId
. This will create the foreign key column named StandardRefId
in the Students
table, preventing the generation of a StandardId
column in the database.
[ForeignKey] on the navigation property in the principal entity:
The [ForeignKey]
attribute can be applied to the navigation property in the principal entity and the related foreign key property name can be specified in the dependent entity as shown below.
public class Student { public int StudentID { get; set; } public string StudentName { get; set; } public int StandardRefId { get; set; } public Standard Standard { get; set; } } public class Standard { public int StandardId { get; set; } public string StandardName { get; set; } [ForeignKey("StandardRefId")] public ICollection<Student> Students { get; set; } }
In the above example, the [ForeignKey]
attribute is applied on the Students
navigation property in the principal entity Standard
. This will create a foreign key column StandardRefId
in the Students
table in the database.
Hope this help !
Error: WebForms UnobtrusiveValidationMode Requires a ScriptResourceMapping For jQuery in .Net
Getting below error after using RequiredFieldValidator for textbox
Error: WebForms UnobtrusiveValidationMode Requires a ScriptResourceMapping For jQuery in .Net
In this post I am trying to explain solution for the above error.
Sample Code :
<asp:TextBox ID=”txtName” runat=”server”></asp:TextBox>
<asp:RequiredFieldValidator ID=”reqName” runat=”server” Display=”Dynamic” ControlToValidate=”txtName” Text=”*” Style=”color: red”></asp:RequiredFieldValidator>
<asp:Button ID=”btnSubmit” Text=”Submit” runat=”server” OnClick=”btnSubmit_Click” />
Now add key for Unobtrusive under web.config file <appSettings> tag as following code.
<configuration>
<system.web>
<compilation debug=”true” targetFramework=”4.5″ />
<httpRuntime targetFramework=”4.5″ />
</system.web>
<appSettings>
<add key=”ValidationSettings:UnobtrusiveValidationMode” value=”None” />
</appSettings>
</configuration>
Entity Framework : Could not load type System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider
When you have separate class library projects for Data access layer which contains your entity model and when you are giving reference of this class library to your web application on build you may get following error
Could not load type System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider
You can solve this error by following line assembly reference in your website project webconfig file
<system.web>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add
assembly="System.Data.Entity.Design, Version=4.0.0.0,Culture=neutral,
PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5" />
</system.web>
Comments