.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

insert into access db problem

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :ASP.Net

First off I need to sa that I am new to asp.net and visual studio.

I have a Web application that shows a gridview of the information on a table and then I have textboxes that are for entering new data into the table.

My problem is I get an error that states that one of my fields has duplicate data which is not possible.  I have looked around and have found no real solution to the problem.  The follow is the gridview code followed by the code behind. 

I have heard that there could be problems with windows 7 64 bit but I can connect to the db and delete records in the gridview.

Thanks in advance for and help.

<br /><h1>WebSites</h1>
     <br />
    <asp:HiddenField ID="hidUser" runat="server" />

    <asp:HiddenField ID="hidPass" runat="server" />

    <table cellpadding="0" cellspacing="0">


                <td style="width: 50px; height: 19px;">



View Complete Post

More Related Resource Links

Problem insert POCO to Velocity Cache



I want to put POCO object to Velocity cache. How can I serializable ICollection to Velocity cache, or exclude ICollection from serialization?

I got this exception

Type 'System.Collections.Generic.ICollection`1[Model.Collection]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.  If the type is a collection, consider marking it with the CollectionDataContractAttribute.  See the Microsoft .NET Framework documentation for other supported types.



Nested listview fk-problem with insert



My problem is this, i have a nested listview that works fine but if i need to do an insert and the nested listview dont have retrived any values (that is no posts created) i cant get hold of the fk that i need. If i put a hiddenfield in the parents listview with the fk how can i find it in codebehind when i do an insert? 



Problem connecting to SQL Server 2008 R2 Express from Access 2007

I have a problem with SQL Server 2008 R2 Express with MS Access 2007. I am running Windows 7 with 8 gigs memory. I installed SQL Server 2008 R2 Express. Do I now need to install SP1 because I am running with Windows 7? I can open SQL Server using the Management Screen but I cannot connect to MS Access 2007 using SQL Server Express as the database. When trying to connect to SQL Server from Access 2007, I keep getting the message that SQL Server 2005 cannot be found. It will not allow me to sign onto sql server 2008 stating that it cannot be found. Do I have to now run the SQL Server 2008 R2 Express SP1? Is there an upgrade to MS Access 2007 which will allow me to use SQL Server 2008 R2 Express?

Problem with access to a user in AD group

Hi all, We are managing our security in Sharepoint (WSS 3.0) with AD groups instead of Sharepoint groups. This worked fine until now. For an unknown reason, one single user from an AD group cannot access a page (while other users from the same group can). The group is also a distribution list in AD (so it's a security group and distribution list for emails). It includes several other distribution lists such as: L-All-Corporate-Employees    L-Administration          User 1          User 2           ...     L-Accounting         User 1         ... ...   So far I never had any issue with that kind of approach,  but yesterday we published a new web part page and wanted only the corporate employees to get access to it, so I broke rights inheritance on the page and added the L-All-Corporate-Employees group with View rights. As I already said, I tested with one user from the group (let's say from the L-Administration sub-group) and it works, now I receive an email from another user (let's say from the L-Accounting sub-group) which tells me he doesn't have access... But they're all part of the L-All-Corporate-Employees group, so they should all

Insert into and Store procedure problem

Hello I am trying to create store procedure wich will insert data in temp table CREATE PROCEDURE GetDataForUpdate AS if exists(select * from sys.objects where name='GetDataForUpdate_temp_tb') begin DROP TABLE GetDataForUpdate_temp_tb end go WITH cte as (select Sp.[Item No_], Sp.[Starting Date], It.[No_], It.[Manufacturer Code], It.[Description], Sp.[Unit Price], row_number () over (partition by Sp.[Item No_] order by Sp.[Starting Date] desc) as rn from dbo.[Main-db$Sales Price] AS Sp JOIN dbo.[Main-db$Item] AS It ON Sp.[Item No_] = It.[No_] WHERE Sp.[Sales Code]='RETAIL' AND Sp.[Item No_] LIKE 'I%' ), cte2 as ( SELECT [Item No_],SUM(ISNULL(Quantity, 0)) AS Qty FROM [Main-db$Item Ledger Entry] WHERE [Item No_] LIKE 'I%' AND ( [Location Code] = 'WH-AB-#2' ) GROUP BY [Item No_] ) SELECT cte.[Manufacturer Code],cte.[Description], CONVERT(int, cte2.[Qty]) AS 'Qty',CONVERT(int, cte.[Unit Price]) AS 'Unit Price' INTO GetDataForUpdate_temp_tb FROM cte JOIN cte2 ON cte.[Item No_]=cte2.[Item No_] WHERE rn = 1 ORDER BY cte.[Item No_],[Starting Date] But after execute, lefts only this part of query in store procedure: set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE [dbo].[GetDataForUpdate] AS if exists(select * from sys.objects where name='GetDataForUpdate_temp_tb') begin DROP TABLE GetDa

SQL Insert with Index Scan Problem....

Hi,   I'm having a very strange problem when inserting rows into a table. Let me try to explain a little better: Table1 (for example Book) with a lot of fields and one foreign key to Table2 (idVolume) and a primary key (identity - idBook). This table has a clustered index only on the primary Key. (this table has something like 10 Millions rows) Table2 (for example Volume) with a lot of fields and a primary key (idVolume) identity. (this table has hundreds of rows)   Now, the problem starts when I make a insertion on Table2. When I made an insertion, it was taking minutes to finish, so I stopped it. After looking into the execution plan of the query, there was something very very strange, there seems to be a clustered index scan on Table1... the problem is that since Table1 has so many rows, this index scan takes forever... Can anyone explain me why does the insertion on Table2 makes an clustered index scan on Table1? It really doesn't make any sense to me.   Thanks in advance. João Teixeira

Basic data type problem with database insert

Hi,I'm trying to write some values into a database, but I think there's an issue with the data types.  Here's what I've got: public static string Hello(string pageId, string inOut) { string itemId = ""; string period = ""; var cookie = HttpContext.Current.Request.Cookies["visitorGUID"].Value; SqlConnection conn; SqlCommand comm; conn = new SqlConnection(GlobalSettings.DbDSN); comm = new SqlCommand("INSERT INTO myTable (memberGUID) VALUES (@memberGUID);", conn); comm.Parameters.Add("@memberGUID", System.Data.SqlDbType.Text); comm.Parameters["@memberGUID"].Value = cookie; try { conn.Open(); comm.ExecuteNonQuery(); return "Item added: cookie = " + cookie + " / pageId = " + pageId + " / inOut = " + inOut + " / pageId = " + pageId + " / itemId = " + itemId + " period = " + period; } catch { return "Item caught: cookie = " + cookie + " / pageId = " + pageId + " / inOut = " + inOut + " / pageId = " + pageId + " / itemId = " + itemId + " period = " + period; } finally { conn.Close(); } } At the moment I'm just trying to insert the value of the cookie into the database as a test.  It works fine when I

Access violation in wpfgfx_v0400.dll - How to find the problem?

I have an access violation exception generated inside wpfgfx_v0400.dll. I have the minidump loaded in visual studio 2010 with all my program's symbols loaded in debug mode. Unfortunately, the stack is of little use. I have searched on the net for help but I could not find anything. I would like to know what I can do from here. Here is the stack for the thread that caused the access violation. Unhandled exception at 0x778b64f4 in WERE8E3.tmp.hdmp: 0xC0000005: Access violation reading location 0x24448900. >   ntdll.dll!778b64f4()      [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]        wpfgfx_v0400.dll!6abb6d2e()          wpfgfx_v0400.dll!6ab9e2d5()          wpfgfx_v0400.dll!6ab22c98()          wpfgfx_v0400.dll!6ab22c98()          wpfgfx_v0400.dll!6ab22c98()          wpfgfx_v0400.dll!6ab23dca()          wpfgfx_v0400.dll!6ab22dbb()          wpfgfx_v0400.dll!6ab291e2()    

Problem with ODBC from MS Access 2007 to MS Sql Server 2008

Hi experts, I need some help with ODBC Connection Settings from MS Access 2007 to Sql Server 2008. Here is the Scenario, I have created a Database(StagingDB) with 5 tables on SQlServer 2008 and I have  Developed an MS Access 2007 Front End using Linked tables and ODBC to Insert/ Update data into these 5 tables. This is just working fine in my Dev database. ODBC Connection Settings are pointing to my DevServer. All I wanted to do now is, I want to point the ODBC Settings to the same database on my Test Server and then to Production Server. I have Changed the Server name in the ODBC File to point it to my Test Server and If I try to Insert  some data into test server its stil going into the database on Dev server. Is this the right way to do. Please help me with this. thanks In Advance..

Bulk Insert Problem

I am trying to perform a bulk insert on pipe delimited file (approx 25 columns,5000+ rows of data).  Normally this is no problem however this file has a header and trailer record with no delimiters (1 column).  I could use a utility like grep to remove the header/trailer record but I would like to capture the entire file inside sql server. I can bulk insert the entire file into a single column (wide) that would include the delimiters.  My problem from there is to process the single column data into the appropriate rows /columns.  I am looking for a set solution as opposed to a cursor type solution. HTML?  Seems slow.  Cross Apply?   Changing the file format is not a viable solution. I’m likely to have more than a few of these oddball formats with a variable number of columns.  Any ideas?   I thank you for your time on this puzzle.

Outlook web access - my calender log in problem

Hi there. We have an intranet solution built on Sharepoint 2010 enterprise. I'm trying to connect the My Calendar web part(found under Outlook web access web parts) to my clients outlook exchange -server. I've set the server to be https://webmail.[company].fi/exchange and the credentials in the web part properties. I get the signing in -part to show on my web part but for some reason cannot log in. There is no error or notification about what went wrong with the login. When I open up a new tab and go straight to https://webmail.[company].fi/exchange and log in with the same credentials that I tried on the web part, I can log in. Now when I go back to my original tab -having the my calendar web part- and refresh, the web part suddenly works and it displays the calendar as it's supposed to. Why can't I log in directly in the My Calendar web part? What could be the problem? Thanks in advance

i got error in insert to database - access

hi i have val `MyDate` in my C# program that contain **today-date** or **null**. i have date field in my access 2007 -  `TdateOpen` i try to insert to  database like this:      SQL = "insert into MyCount(TdateOpen) values ('" + MyDate +"')";                         and i got this error:     Data type mismatch in criteria expression what can be the problem ? thank's in advance

Join Expression Not SHi All, I use Access 2007, and I have the following SQL problem: I have two t

Hi All,

I use Access 2007, and I have the following SQL problem:

I have two tables TransformerTypePeriodBOMProducts and TransformerTypePeriodProducts. The first table has 4 fields: TransformerTypeID, OutputProductID, PeriodID and BOM, while the second has the following 4 fields: TransformerTypeID, OutputProductID,PeriodID and AssemblyCapacity. So as you can see, there are 3 fields (TransformerTypeID, OutputProductID and PeriodID) that are in both tables.

I need to delete all records in the first table that have the field AssemblyCapacity in the second table equal to 0 (and of course have similar TransformerTypeID, OutputProductID and PeriodID fields).

I tried many trials, the last I got was:

SELECT TransformerTypeAssemblyPeriodBOMProducts.*
FROM ((TransformerTypeAssemblyPeriodBOMProducts INNER JOIN TransformerTypeAssemblyPeriodProducts ON TransformerTypeAssemblyPeriodBOMProducts.TransformerTypeID=TransformerTypeAssemb
lyPeriodProducts.TransformerTypeID) INNER JOIN TransformerTypeAssemblyPeriodProducts ON TransformerTypeAssemblyPeriodBOMProducts.OutputProductID=TransformerTypeAssembly
PeriodProducts.OutputProductID) INNER JOIN TransformerTypeAssemblyPeriodProducts ON TransformerTypeAssemblyPeriodBOMProducts .PeriodID=TransformerTypeAssemblyPeriodProducts.PeriodID
DELETE * FROM TransformerTypeAssemblyPeriodB

insert date problem when culture is arabic



I want to insert date value in database

when my page loads i am setting the culture into ar-sa

and when insert date i am getting the problem

SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

Public Sub Add_Date(ByVal title As String, ByVal Schedule_date As Date)
            command.CommandText = "sp_Schedule_DML"
            command.CommandType = CommandType.StoredProcedure
            If Schedule_date = Nothing Then
                command.Parameters.AddWithValue("@optSelect", 0)
                command.Parameters.AddWithValue("@title", title)
                command.Parameters.AddWithValue("@sdate", System.DBNull.Value)
                command.Parameters.AddWithValue("@optSelect", 0)
                command.Parameters.AddWithValue("@title", title)
                command.Parameters.AddWithValue("@sdate", Schedule_date)
            End If
            If connection.State = Data.ConnectionState.Closed Then
            End If
            If connection.State = Data.ConnectionState.Open Then
            End If
        Catch ex As Exception
            Throw New Exce

Insert data to ms access from datagridview using dataset


please give me sample code for insert data to MS ACCESS  from grid view using dataset

Access Denied - CWP Insert Hyperlink



In Moss 2007

And  in content Editor Webpart -> Insert Hyperlink -> click browse -> Access Denied!

When click browse trying to access /_layouts/AssetPortalBrowser.aspx?

Even user is publisher or admin

Please let me know your thoughts


Insert XML data into table problem


For the life of me I cannot figure out what's wrong with my SP. I'm receiving an XML document with a bunch of invoices like


And I need to write each invoice as a record in SQL Server 2005

I'm getting the following error

Msg 170, Level 15, State 1, Procedure pcdAddInvoices, Line 39
Line 39: Incorrect syntax near '.'.


 -- Add the parameters for the stored procedure here

 @msg xml
 -- SET NOCOUNT ON added to prevent extra result sets from
 -- interfering with SELECT statements.

    -- Insert statements for procedure here
 INSERT INTO [Promacoin].[dbo].[Tblinvoices_DAX] (ObjectID,ActivityID,ResourceID,ContractID,Document
 SELECT M.Invoice.value('/ObjectID','NVARCHAR(16)') AS ObjectID,

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