SqlBulkCopy is a class that was added to the .NET Framework version 2.0. It provides feature likeimport data from one database to other Microsoft SQL Server database.By using this you can get data from one database manupulate data then bulk copy that data into other database programmatically.
public int ImportData(string connectionString)
...
Saturday, August 24, 2013
Wednesday, August 14, 2013
Add new record in database usinbg Entity Framework/Entity Framework - Inserting Data to Database
For adding new objects to the Entity Set, you need to create an instance of an Entity type and add the object to the object context.
public bool StudentDetail(StudentDetail objstudetail)
{
StudentDetail studetail = new StudentDetail();
studetail.ID = objstudetail.ID;
studetail.Name = objstudetail.Name;
studetail.Age...
How to Create connection string dynamically asp.net/c#
Below code explains how can we create connection string dynamically in web.config file.
make a connection string in web.config as given below:
<add key="conString" value="Data Source={0};Initial Catalog={1};User ID=sa;Password=pass;Trusted_Connection=False;Persist Security Info=True" />
C# code
private static string ConnectionString(string...
Sunday, August 11, 2013
This row already belongs to this table asp.net and c#.
Solution : Please check below line of code.Have you implemented in your logic or not?
DataRow dreMyData = eMyNewDataTable.NewRow...
The SelectCommand property has not been initialized before calling 'Fill'.
Solutions : You have to specify select command of SqlDataAdapter before filling your table.
Your SqlCommand object is not connected in any way to your SqlDataAdapter.Please check below line have you implemented in your code.
adp.SelectCommand=c...
Losing file in a file upload control in update panel c# asp.net/File Upload Control is not working in Update Panel
Solution : By Using Trigger option we need to Trigger the upload button from AsyncPostBackTrigger to PostBackTrigger.
So that after Postback when user clicked a button to upload file control will available.
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>...
LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.
Solution : Please check below code which is working in my case.After solving above error.
public IList<EMPData> GetEMPDataList(Guid empid)
{
IList<EMPData> objEMPData = null;
try
{
using (EMPDataDBEntities context = new EMPDataDBEntities3())
{
objData = context.EMPDatas.Where(entity...
Could not install : Newtonsoft.Json
Solution : If you failed to install form Manage Newget Package (Right click on project)
start this PM> Install-Package Newtonsoft.Json (Tools -> NewGet Package Manager - > Package Manager Conso...
Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
Solution : In package manager Console execute: Update-Package –reinstall Newtonsoft.Js...
Access to the path is denied
Solution :
1.check your path is correct
2.permission should be acces to ...
Cannot convert lambda expression to type 'string' because it is not a delegate type
Solution : using System.Li...
System.Net.Http.HttpContent' does not contain a definition for 'ReadAsAsync' and no extension method.
Solution: Add a reference to System.Net.Http.Formatting.dll. This assembly is also available in the C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies fold...
Unable to start debugging on the web server.The web server is not configured correctly.See help for common configuration errors. Running the web page outside of the debugger may provide further information.
Solution : Open the command prompt and run ASPNET_REGIIS.EXE with -i parameter
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis...
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Company'.
Sol: Check the GridView columns and select query which you are using for bind GridView.Columns should be same in both pla...
'System.Web.UI.WebControls.TextBox' does not contain a definition for 'Value' and no extension method 'Value' accepting a first argument of type 'System.Web.UI.WebControls.TextBox' could be found (are you missing a using directive or an assembly reference?)
Sol:You have take a textbox control in page but assign textbox.value in cs code. Use Textbox.Te...
A network-related or instance-specific error occurred while establishing a connection to SQL Server
Things to check:
1. Make sure your database engine is configured to accept remote connections
Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration
Click on Surface Area Configuration for Services and Connections
Select the instance that is having a problem > Database Engine > Remote...
EXECUTE permission denied on object 'usp_login', database 'Database', schema 'dbo'
Please check your database user roles.
It's necessary the database user to be owner.
What you should instead do, is grant the user the following Roles:
- aspnet_Membership_FullAccess
- aspnet_Roles_FullAccess
- etc. depending on what features you have enabled/installed into this database
Do this by using Microsoft SQL Server Management Studio or...
No overload for method 'GetInstitute' takes '3' arguments
Sol: check your calling mathod parameter not mat...
Procedure or Function 'genInstituteMaster_SelectDelete' expects parameter '@Select', which was not supplied.
Sol: Parameter mismatch check in c# code passing paramet...