.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links


Posted By:      Posted Date: October 04, 2010    Points: 0   Category :ASP.Net

I'm newbee in ASP.NET. I'm using Visual Studio to produce a webpage.

I would like to add values in a table, but I can't. Need your precious help.

I have some text boxes in a Page with a button and I want to put the values of the text boxes into a table. My code for the button is this:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim connString As String = ConfigurationManager.ConnectionStrings("LoopGestDB").ConnectionString
        Dim cmd As Data.SqlClient.SqlCommand = Nothing

View Complete Post

More Related Resource Links

Hiding radGrid Popup EditFrom after Udate/Insert Issue

Anyone work with radGrid that may be able to assist me in this I would greatly appreciate it.  I just cant seem to put my finger on why this is occurring, but...I have a radGrid that uses a template in the <editform> for insertion and update of grid records.  I am using the popup style instead of the inline (but this is occurring with all types).  When I click edit or new, the edit form displays perfectly.  When I make my changes or additions and submit them, the grid updates as it should with the new record, all changes/additions are made perfectly except one detail - the edit form will not go away!  It stays in edit mode and even shows the changes that were made no problem...  I tried to add the following to the Inserted and Updated event, but these do not seem to do a thing: Protected Sub grid_partners_ItemInserted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridInsertedEventArgs) Handles grid_partners.ItemInserted grid_partners.MasterTableView.IsItemInserted = False End Sub Protected Sub grid_partners_ItemUpdated(ByVal source As Object, ByVal e As Telerik.Web.UI.GridUpdatedEventArgs) Handles grid_partners.ItemUpdated grid_partners.MasterTableView.ClearEditItems() End SubAnyone know a better way, or I should say ANY WAY to do this?

SQL XML Bulk Insert 3 tables format issue


I would like to ask for you help finding a problem in my XML schema.  I need to do a bulk insert into 3 tables that are linked.  I have an address, site and customer table. It is an SQL Server 2008 Database


The customer table links to its address in the address table.  The Address table contains no links to other tables and the site table contains a link to the customer and to the sites address.

From my understanding of this bulk insert procedure, I need to insert my address for my customer then my customer with a link to its address.  Then I want to insert my sites for my customer but they need their addresses too so I want to insert the site address and then the site with the key relationships to its address and customer row in those tables.

The xsd file is below that I have at the moment:

<?xml version="1.0" encoding="utf-8"

SQL insert performance issue


Hi all,

im taking a long period of time to do SQL insertion.

basically it takes ard 4ms for a record insert. Using query analyzer, i used a for loop and insert into a table 10000 times. the result 42 secs. I need to shorten this time taken as im doing some simulation work and real time analysis.

I am using scope_ident() to grab the primary key of a table and insert this primary key into another table. hence i don't think using bulk insert is possible.  

im using SQL Server 2000.

Pls help. thank you.

Insert into merge replication database issue...


I've been fighting with merge replication for the past few days over the same hurdle and I can't seem to figure this one out.  I create the publication that publishes 36 articles (28 of which are download only).  After creating the publication, I can replicate perfectly normal as expected.  When replicating, I pass in a project number through the host_name() variable and filter the data based on that value and all works great.  I've replicated about 10 different projects, modified data, and merged the changes back without issue.

Where I'm running into an issue is when I add a new project to the mix.  I have an SSIS project that takes data and puts the data into a staging area.  From there, I have an ETL that pulls the data from the staging area and inserts it into the the database that is set up with merge replication.  Being that these new records will need to be replicated in the future, I do a simple insert into, select from so that the replication triggers are fired and these rows are tracked.

After the data load (~150,000 rows in total among 5 tables), I go to replicate this new project however it never gets past the step

"Retrieving subscription information."

It eventually times out and never transfers the data.  When I go back and try to rep

Insert value using Table Value Functions

a real gem in Sql Server 2008. mostly people still using Stored procedure may be they shifted to SQL Server but they are not using TVF right now.

Insert Rows with a GridView

In ASP.NET version 1.x, I used the footer on the DataGrid control to insert new rows by placing a series of TextBox, DropDownLists, CheckBoxes etc. controls on it and then handling a save button. This also works with the GridView in version 2.0 but with one major exception: if your data source is empty, the GridView will hide your footer (and header) and only display the EmptyDataText.

SqlCommand.ExecuteNonQuery() returns -1 when doing Insert / Update / Delete

Sometimes you end up with a return value of -1 when using the SqlClient.SqlCommand.ExecuteNonQuery method.

Why is that?

Well, the ExecuteNonQuery method is there for statements for changing data, ie. DELETE / UPDATE /INSERT, and the returned value are the number of rows affected by that statement.

When checking the documentation we can see that there are some conditions that return -1.

For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command.

When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of

rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.

IsapiModule Error 500 Issue


I am about exhausted trying to figure out this error:

HTTP Error 500.0 - Internal Server Error

Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x8007007b

Notification: ExecuteRequestHandler

Module: IsapiModule

Requested URL: http://localhost:80/ReportServer

Physical Path: c:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer

When I enable Failed Request Tracing Rules and view the log output I am supposing that the actual problem is in the 2nd call where there are 2 backslashes before the actual filename in the specified path:


CALL_ISAPI_EXTENSION DllName="C:\Windows\Microsoft.NET\Framework\v2.0.50727\\aspnet_isapi.dll"


MVC2 issue - Stuck. Trying to create a cms with nested partials


I am currently trying to display multiple items on a single page. I am not sure as to how to tackle this. What I have is a database table that has all the page data in. I have this run as a PagesController and this works fine. However what I would like to do is, if say the Products page is selected via the menu, I want to pull back not only the Products page html but also get all the products, and even be able to pull them through via category. I was trying to use a partial view, but I can't get it to work. The same would be for other pages, having partial views to display the other content, ie if Gallery is selected, the page html for Gallery shows and it then can push to a partial view that pulls all the gallery images from the gallery db table and so on. 

Maybe I am tackling this the wrong way. I have the pages stored in the db to allow for a CMS system I have setup. Maybe I need to use models for all the other items(Products, Gallery, Videos and such) and use the partial for the page html?

Any help would be greatly appreciated as I am confused.

Insert Error not helpful



I am using VS2010

When I try to updated or insert a record in my User table I am getting an error that does not make sense to me and I cannot figure out what is wrong.

Also, when I try to insert a new record I get a validation error saying that the Id is required. However it is an identity field in the db so it should not be necessary to send it to the server.

Could you please shed some light?


An error has occurred.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Microsoft.Web.UI.WebControls.EntityOperationException: An error has occurred.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:

[EntityOperationException: An error has occurred.]
   Microsoft.Web.UI.WebControls.DomainDataSourceView.PerformCudOperation(ChangeSetEntry operation, Action`1 operationPerformingEvent, Action`1 operationPerformedEvent) +331
   Microsoft.Web.UI.WebControls.DomainDataSourceView.UpdateObject(Object oldEntity, O

Detecting Edit or Insert Page


I am coding a .cs file that handles the metadata for a particular table. I am putting a custom validation that allows me to update or insert only if the PubMedID is not already in the database. This would be easy except that the PMID should also be allowed to be null as some of the references in the database were not from PubMed. So i perform a query on the database to see if there is already an identical PMID in the database. This works great when using Insert. However, when using Edit, it does not. The PMID is already in the database because the one currently being edited has the same PMID!!! So I know exactly how to change my query etc. However, I do not know how to tell from inside this Edit/Insert agnostic page, which one it is being called from. Thanks for your help! 

xpath issue


Hi i am using xpath to loop through each node,

the xml is below i can get the value of "link" but i cant get the thumbnail value, have you got any ideas how i can do this, my code is below.



     <link>test 1</link>
     <media:thumbnail url="http://test.com/image.jpg" height="75" width="75" />



     <link>test 2</link>
     <media:thumbnail url="http://test.com/image.jpg" height="75" width="75" />


public void FindLinks(XPathNavigator p_xPathNav, DataTable dt)
            //run the XPath query
            XPathNodeIterator xPathIt = p_xPathNav.Select("//item");

            //use the

User validation Issue in xlsx file



I am validating user from Login.xlsx file. It was working fine by validating email and password from that file. For testing i got new file same contents of file but added some more user names.

So after that when i validating the user i am getting the following error "Data type mismatch in criteria expression".

But when i replaced the new to old one it is working fine. The contens of both files are the same. So why this kind of error happened.


how To Insert the single quotes in sqlcommand in asp.net


Hi all

    i am developed on simple user registeration application in that i gave  address field .when i am trying to enter something like this (1st main,b'lore) but wont take while inserting.

my query is

sqlcommand cmd=new sqlcommand("insert into registeration_form(name,address)values('"+txtname.text+"','"+txt_address+"')",con);

how can i pass the  quotes also to my query please if any one know reply me.


G Dinakaran

Insert data to Excel using OLEDB



I am trying to insert data to Excel Document using OLEDB as follows:-

 sql = "Insert into [MyFirstSheet$] (" + Title1 + "," +Title2 + "," + Title3 + ") 
values('" + Value1 + "','" + Value2 + "','" + Value2 + "')";
myCommand.CommandText = sql;

 sql = "Insert into [MyFirstSheet$] (" + Title1 + "," +Title2 + "," + Title3 + ") 

values('" + Value1 + "','" + Value2 + "','" + Value2 + "')";

myCommand.CommandText = sql;


But, the Title1 ,Title2, Title3 are in the 3rd row of the Excel Document. So, the data is not inserted.

Multiple Paramatized Threading issue


I need the funcitonality to have two methods run concurrently of each other and the parent thread (aka the method that makes these two calls) to halt until BOTH are done. After the threads are done, I need to perform logic on the returns of the method, so it is essential for both of them to be complete before the parent thread continues. I have searched the internet and tried varous attacks, and I always come up with the same result, this being the parent thread continues operation after the first thread finishes, leaving the second thread running.  Can someone show me a quick example of how I can do this. I have tried checking states of the threads, halting the threads, but I always end up with the same thing. Any help would be great. Thanks.

Data Truncation issue with Enterprise Library Logging WriteLog stored Proc


Hi ,

I'm using Enterprise Library Logging  feature for logging. The issue i am facing is when the Logging message is too large(more than 65534 chars) ,complete data  is not logged in the Formatted Mesage column which is  of data Type nText .

I am able insert complete data if i try inserting from Sql insert Query from sql management studio. Do i need to add any attributes to data base listener or do i need to change the sp.

 Is there any way to increase the WriteLog stored proc param size in EnterpriseLibrary.Logging config file ? . Please let me know.


Thanks In Advance.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend