Simple DB Operations Are Throwing Native Exception Error - 0xc0000005 - Intermittently

Dec 4, 2006

Hi All,

We have written a multithreaded application in which we are maintaining separate Database connections for each thread. these connections are opened and closed at the start and exit of the thread.

We have observed that even if there is only one thread running ( application thread), execution of simple Select queries some times throws Native exception(Error - 0xc0000005 ).

This error comes intermittently. Execution of same query doesn't throw exception.

Further investigation by breaking the debug at the time of native exception and then looking into the stack trace shows that native exception has occured at one of the Native API (CompileQueryPlan() ) which is being called implicitly by the SQL Mobile.

Each time when we see native exception stack trace shows failure at CompileQueryPlan() call.

Let me know if this is a known defect in SQL Mobile 2005 or there is something else that is causing native exception.

Thanks,

Nikhil











View 11 Replies


ADVERTISEMENT

Native Exception 0xc0000005 When Using SQLCE 3.0/3.1 And .NET CF 2.0?!

Oct 3, 2007

Greetings,



I have written a very basic C# console test app to check the performance and reliability of SQLCE on Windows CE 5.0 (source code below). Running this on different Windows CE 5.0 devices, I always get a 0xc0000005 native exception error when reaching 25592 inserts. It doesn't matter whether the database is empty or not when the test is run, it always fails at that exact number of inserts. Given that I would expect a managed application not to be able to generate native exceptions anyway, and can't really see any reason why it would in this case, I'm at a bit of a loss as to what's going wrong... Any ideas?



Using:
VS2005 w/ SP1
Windows CE 5.0 (on custom SH4 platform and HTC WM5 smartphone)
.NET CF 2.0 w/ SP1 and post SP1 patch
SQLCE 3.0.3600.0





TIA

PS. The same code (with some SQLCE 3.0 specific bits removed - version and result set for checking table existence) works perfectly under .NET CF 1.0 and SQLCE 2.0).





Source code:





using System.Data;
using System.Data.SqlServerCe;





namespace TestDB
{
class Program
{
static void Main(string[] args)
{
SqlCeConnection sqlConnection = new SqlCeConnection();
SqlCeCommand sqlCommand = sqlConnection.CreateCommand();
SqlCeResultSet sqlResult;





string strDatabase = "\TestDB.sdf";
string strTable = "TestTable";





try
{
// Database connection string
sqlConnection.ConnectionString =
"Data Source=" + strDatabase;





// Database file doesn't exist?
if (!System.IO.File.Exists( strDatabase ))
{


Console.WriteLine("Creating database: " + strDatabase);





// Create SQL engine object
SqlCeEngine sqlEngine = new SqlCeEngine(
sqlConnection.ConnectionString);



// Use it to create database


sqlEngine.CreateDatabase();
}





Console.WriteLine("Opening database: " + strDatabase);





// Open database connection
sqlConnection.Open();





// Display SQL version
Console.WriteLine("SQL Version: "
+ sqlConnection.ServerVersion.ToString());





// Check if table exists
sqlCommand.CommandText = "SELECT TABLE_NAME FROM "
+ "INFORMATION_SCHEMA.TABLES WHERE "
+ "TABLE_NAME = '" + strTable + "'";
sqlResult = sqlCommand.ExecuteResultSet(
ResultSetOptions.Insensitive);





// Table doesn't exist?
if (!sqlResult.Read())
{
Console.WriteLine("Creating table: " + strTable);





// Create table
sqlCommand.CommandText = "CREATE TABLE " + strTable
+ "(Sequence integer IDENTITY(1,1) NOT NULL PRIMARY KEY, "
+ "Timestamp datetime DEFAULT GETDATE(),"
+ "Message nvarchar(80))";
sqlCommand.ExecuteNonQuery();
}





string strText;


for (int i = 1; i <= 500000; i++)
{
Console.Write("
Inserted " + i.ToString() + " records ");





strText = "Row Number: " + i.ToString();


sqlCommand.CommandText = "INSERT INTO " + strTable
+ " (Message) VALUES ('" + strText + "')";
sqlCommand.ExecuteNonQuery();
}
}
// SQL error
catch(SqlCeException sqlex)
{
// Display all error messages
Console.WriteLine( "ERROR:" );
foreach (SqlCeError sqlError in sqlex.Errors)
{
Console.WriteLine( sqlError );
}
}
// Other errors
catch(Exception ex)
{
// Display error message
Console.WriteLine( "ERROR:" );
Console.WriteLine( ex.Message );
}
finally
{
// Close connection
if (sqlConnection.State != ConnectionState.Closed)
{
Console.WriteLine("Closing database");


sqlConnection.Close();
}
}


Console.ReadLine();
}
}
}

View 6 Replies View Related

Exception 0xc0000005 EXCEPTION_ACCESS_VIOLATION At 0x00402484

Jul 25, 2007

my sql server give me a error log,who can help me?



2007-07-06 09:58:46.09 spid56 SqlDumpExceptionHandler: Process 56 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process..
*******************************************************************************
*
* BEGIN STACK DUMP:
* 07/06/07 09:58:46 spid 56
*
* Exception Address = 00402484
* Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION
* Access Violation occurred reading address 199A0F64
* Input Buffer 190 bytes -
* delete from cms_paramdb1..Param where PatientiID = 427 and Occurtime =
* '2007-06-12 17:51:39'
*
*
* MODULE BASE END SIZE
* sqlservr 00400000 00B19FFF 0071a000
* ntdll 7C920000 7C9B3FFF 00094000
* kernel32 7C800000 7C91BFFF 0011c000
* ADVAPI32 77DA0000 77E48FFF 000a9000
* RPCRT4 77E50000 77EE0FFF 00091000
* USER32 77D10000 77D9EFFF 0008f000
* GDI32 77EF0000 77F35FFF 00046000
* OPENDS60 41060000 41065FFF 00006000
* MSVCRT 77BE0000 77C37FFF 00058000
* UMS 41070000 4107CFFF 0000d000
* SQLSORT 42AE0000 42B6FFFF 00090000
* MSVCIRT 00300000 00310FFF 00011000
* ShimEng 5CC30000 5CC55FFF 00026000
* AcSpecfc 71540000 71580FFF 00041000
* ole32 76990000 76ACBFFF 0013c000
* SHELL32 773A0000 77B90FFF 007f1000
* SHLWAPI 77F40000 77FB5FFF 00076000
* WINMM 76B10000 76B39FFF 0002a000
* DDRAW 736D0000 73718FFF 00049000
* DCIMAN32 73B30000 73B35FFF 00006000
* USERENV 759D0000 75A7DFFF 000ae000
* MPR 71A90000 71AA1FFF 00012000
* PSAPI 76BC0000 76BCAFFF 0000b000
* comdlg32 76320000 76366FFF 00047000
* COMCTL32 5D170000 5D206FFF 00097000
* IMM32 76300000 7631CFFF 0001d000
* WS2_32 71A20000 71A36FFF 00017000
* WS2HELP 71A10000 71A17FFF 00008000
* LPK 62C20000 62C28FFF 00009000
* USP10 73FA0000 7400AFFF 0006b000
* comctl32 77180000 77281FFF 00102000
* sqlevn70 41080000 41086FFF 00007000
* NETAPI32 5FDD0000 5FE23FFF 00054000
* wmi 76D00000 76D03FFF 00004000
* SSNETLIB 42CF0000 42D05FFF 00016000
* WSOCK32 71A40000 71A4AFFF 0000b000
* SSNMPN70 410D0000 410D5FFF 00006000
* security 71F00000 71F03FFF 00004000
* SECUR32 77FC0000 77FD0FFF 00011000
* crypt32 765E0000 76671FFF 00092000
* MSASN1 76DB0000 76DC1FFF 00012000
* VERSION 77BD0000 77BD7FFF 00008000
* SSmsLPCn 42CD0000 42CD6FFF 00007000
* ntdsapi 76770000 76782FFF 00013000
* DNSAPI 76EF0000 76F16FFF 00027000
* WLDAP32 76F30000 76F5BFFF 0002c000
* sqlimage 4A400000 4A40CFFF 0000d000
* DBGHELP 020F0000 02102FFF 00013000
*
* Edi: 19991FFC: 16290F65 00000000 00000000 00000000 00000000 00000000
* Esi: 01F6D244: 19990F65 0000FFFF 00000000 00000000 01F6D2D8 00000000
* Eax: 19990F65: FFFFFFFF FFFFFFFF 75405AFF 8C969852 03DB62E5 FFFFFFFF
* Ebx: 19990000: 00000301 00FF0000 00000000 00000000 00000000 00060000
* Ecx: 0000FFFF:
* Edx: 00000026:
* Eip: 00402484: 0114B70F 83145689 EAC107C2 0A4C8D03 184E8902 752000F6
* Ebp: 01F6D264: 01F6D298 00576A9E 00000001 01F6D310 01F6D308 01F6D2D8
* SegCs: 0000001B:
* EFlags: 00010202: 0053005C 00730079 00650074 0033006D 005C0032 00620057
* Esp: 01F6D234: 01F6D244 0040289C 01F6D2D8 00408FEA 19990F65 0000FFFF
* SegSs: 00000023:
*******************************************************************************
-------------------------------------------------------------------------------
Short Stack Dump
00402484 Module(sqlservr+00002484)
00576A9E Module(sqlservr+00176A9E) (SQLExit(unsigned long)+00021C8C)
0057620B Module(sqlservr+0017620B) (SQLExit(unsigned long)+000213F9)
005021AC Module(sqlservr+001021AC)
0041ED96 Module(sqlservr+0001ED96)
00442DD0 Module(sqlservr+00042DD0)
004BFD41 Module(sqlservr+000BFD41)
00427985 Module(sqlservr+00027985)
004271BA Module(sqlservr+000271BA)
0042EA36 Module(sqlservr+0002EA36)
0042E82D Module(sqlservr+0002E82D)
004160DB Module(sqlservr+000160DB)
00415765 Module(sqlservr+00015765)
00415410 Module(sqlservr+00015410)
005A683F Module(sqlservr+001A683F) (SQLExit(unsigned long)+00051A2D)
004160DB Module(sqlservr+000160DB)
00415765 Module(sqlservr+00015765)
00415410 Module(sqlservr+00015410)
00459A54 Module(sqlservr+00059A54)
004175D8 Module(sqlservr+000175D8)
410735D0 Module(UMS+000035D0) (UmsSystemUserContext::UmsSystemUserContext(class UmsScheduler *,struct UMS_SYSPARAMS *)+00000434)
4107382C Module(UMS+0000382C) (UmsScheduler::FiberEnabled(void)+000001D2)
77C0A243 Module(MSVCRT+0002A243) (_endthread+000000AF)
7C80B50B Module(kernel32+0000B50B) (GetModuleFileNameA+000001B4)
-------------------------------------------------------------------------------
2007-07-06 09:58:46.26 spid56 Error: 0, Severity: 19, State: 0
2007-07-06 09:58:46.26 spid56 language_exec: Process 56 generated an access violation. SQL Server is terminating this process..
2007-07-06 09:58:50.28 spid57 Error: 7105, Severity: 22, State: 6
2007-07-06 09:58:50.28 spid57 Page (1:3568), slot 0 for text, ntext, or image node does not exist..

View 6 Replies View Related

Exception 0xc0000005 EXCEPTION_ACCESS_VIOLATION Reading Address 637B7FC0 At 0x77387EAC

Nov 30, 2006

Hi i am connecting to a DB2 database on a AS400 machine from SQL server 2005.
I have setup a linked server to connect to the DB2 database.

Most of the time the query ( select * from OPENQUERY(lnkd_svrname,'select abc from svr_name.lib_name.tablename') ) works fine but at times it comes up with the following error.

I am running SQL server 2000 Std. Edition on a WIN 2000 machine.

Any help would be appreciated .
*****ERROR*****
From the Exception.Log file

11/30/06 09:38:59 spid 69 Exception 0xc0000005 EXCEPTION_ACCESS_VIOLATION reading address 637B7FC0 at 0x77387EAC




STACK DUMP ----------------------------------
=====================================================================
BugCheck Dump
=====================================================================

This file is generated by Microsoft SQL Server
version 9.00.1399.06
upon detection of fatal unexpected error. Please return this file,
the query or program that produced the bugcheck, the database and
the error log, and any other pertinent information with a Service Request.


***Stack Dump being sent to C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLLOGSQLDump0024.txt
SqlDumpExceptionHandler: Process 69 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is
terminating this process.
* *******************************************************************************
*
* BEGIN STACK DUMP:
* 11/30/06 09:38:59 spid 69
*
*
* Exception Address = 77387EAC Module(USER32+00007EAC)
* Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION
* Access Violation occurred reading address 637B7FC0
* Input Buffer 182 bytes -
* select * from OPENQUERY(lnkd_svrname,'select abc from svr_name.lib_name.tablename')
*
*
MODULE BASE END SIZE
* sqlservr 01000000 02BA7FFF 01ba8000
* ntdll 7C800000 7C8BFFFF 000c0000
* kernel32 77E40000 77F41FFF 00102000
* MSVCR80 78130000 781CAFFF 0009b000
* msvcrt 77BA0000 77BF9FFF 0005a000
* MSVCP80 7C420000 7C4A6FFF 00087000
* ADVAPI32 77F50000 77FEBFFF 0009c000
* RPCRT4 77C50000 77CEEFFF 0009f000
* USER32 77380000 77411FFF 00092000
* GDI32 77C00000 77C47FFF 00048000
* CRYPT32 761B0000 76242FFF 00093000
* MSASN1 76190000 761A1FFF 00012000
* Secur32 76F50000 76F62FFF 00013000
* MSWSOCK 71B20000 71B60FFF 00041000
* WS2_32 71C00000 71C16FFF 00017000
* WS2HELP 71BF0000 71BF7FFF 00008000
* USERENV 76920000 769E3FFF 000c4000
* opends60 333E0000 333E6FFF 00007000
* NETAPI32 49DE0000 49E37FFF 00058000
* SHELL32 7C8D0000 7D0D3FFF 00804000
* SHLWAPI 77DA0000 77DF1FFF 00052000
* comctl32 77420000 77522FFF 00103000
* psapi 76B70000 76B7AFFF 0000b000
* instapi 48060000 48069FFF 0000a000
* sqlevn70 4F610000 4F7A0FFF 00191000
* SQLOS 344D0000 344D4FFF 00005000
* rsaenh 68000000 6802EFFF 0002f000
* AUTHZ 76C40000 76C53FFF 00014000
* MSCOREE 34180000 341C4FFF 00045000
* ole32 77670000 777A3FFF 00134000
* msv1_0 76C90000 76CB6FFF 00027000
* iphlpapi 76CF0000 76D09FFF 0001a000
* kerberos 343F0000 34447FFF 00058000
* cryptdll 766E0000 766EBFFF 0000c000
* schannel 76750000 76776FFF 00027000
* COMRES 77010000 770D5FFF 000c6000
* XOLEHLP 344B0000 344B5FFF 00006000
* MSDTCPRX 48070000 480E7FFF 00078000
* msvcp60 780C0000 78120FFF 00061000
* MTXCLU 480F0000 48108FFF 00019000
* VERSION 77B90000 77B97FFF 00008000
* WSOCK32 71BB0000 71BB8FFF 00009000
* OLEAUT32 77D00000 77D8BFFF 0008c000
* CLUSAPI 48110000 48121FFF 00012000
* RESUTILS 48130000 48142FFF 00013000
* DNSAPI 76ED0000 76EFEFFF 0002f000
* winrnr 76F70000 76F76FFF 00007000
* WLDAP32 76F10000 76F3DFFF 0002e000
* rasadhlp 76F80000 76F87FFF 00008000
* security 48570000 48573FFF 00004000
* msfte 49910000 49B67FFF 00258000
* dbghelp 48DD0000 48EE7FFF 00118000
* WINTRUST 76BB0000 76BDAFFF 0002b000
* imagehlp 76C10000 76C38FFF 00029000
* dssenh 68100000 68123FFF 00024000
* hnetcfg 49330000 49388FFF 00059000
* wshtcpip 71AE0000 71AE7FFF 00008000
* NTMARTA 77E00000 77E21FFF 00022000
* SAMLIB 493D0000 493DEFFF 0000f000
* ntdsapi 766F0000 76704FFF 00015000
* xpsp2res 493E0000 496A4FFF 002c5000
* CLBCatQ 777B0000 77832FFF 00083000
* sqlncli 496B0000 498CDFFF 0021e000
* COMCTL32 77530000 775C6FFF 00097000
* comdlg32 762B0000 762F9FFF 0004a000
* SQLNCLIR 007A0000 007D2FFF 00033000
* msftepxy 498D0000 498E4FFF 00015000
* xpstar90 62080000 620C4FFF 00045000
* SQLSCM90 620E0000 620E8FFF 00009000
* ODBC32 62100000 6213CFFF 0003d000
* BatchParser90 62140000 6215DFFF 0001e000
* SQLSVC90 62170000 62189FFF 0001a000
* SqlResourceLoader 621A0000 621A5FFF 00006000
* ATL80 7C630000 7C64AFFF 0001b000
* odbcint 62380000 62396FFF 00017000
* SQLSVC90 623A0000 623A2FFF 00003000
* xpstar90 623B0000 623D5FFF 00026000
* xpsqlbot 62400000 62405FFF 00006000
* xplog70 62520000 6252BFFF 0000c000
* xplog70 62540000 62542FFF 00003000
* oledb32 62840000 628B8FFF 00079000
* MSDART 486E0000 486F9FFF 0001a000
* OLEDB32R 488F0000 48900FFF 00011000
* msdasql 62D80000 62DCCFFF 0004d000
* MSDATL3 62DD0000 62DE4FFF 00015000
* MSDASQLR 48700000 48703FFF 00004000
* comsvcs 62F00000 63038FFF 00139000
* cwbodbc 66F30000 66F9CFFF 0006d000
* cwbcore 676C0000 6774BFFF 0008c000
* cwbunpls 64B90000 64B99FFF 0000a000
* MFC42 63040000 63160FFF 00121000
* WININET 77210000 772B7FFF 000a8000
* cwbrw 67590000 675B9FFF 0002a000
* MSVCIRT 62E70000 62E7FFFF 00010000
* SHFOLDER 766D0000 766D8FFF 00009000
* cwbad1 677A0000 677A6FFF 00007000
* CWBUNPLA 64BA0000 64BDAFFF 0003b000
* cwbsof 64E00000 64E2EFFF 0002f000
* cwbnl 67630000 67634FFF 00005000
* cwbsv 67580000 67585FFF 00006000
* cwbco 67750000 67754FFF 00005000
* cwbsy 67570000 67574FFF 00005000
* cwbrc 675C0000 675D0FFF 00011000
* cwbunssl 64B80000 64B8DFFF 0000e000
* cwbad 677B0000 677B3FFF 00004000
* cwbbsspi 67760000 6776FFFF 00010000
* cwbbspc 67770000 67781FFF 00012000
* CWBSOMRI 63200000 6320DFFF 0000e000
* cwbodmsg 63210000 63214FFF 00005000
* odbccp32 63230000 63249FFF 0001a000
* cwbcomsg 63250000 6325DFFF 0000e000
* dbghelp 63540000 63657FFF 00118000
*
* Edi: 61C1EABF: 00000020 C8017800 0001AD48 C8017800 0D092848 82F9DD00
* Esi: 637B7FC1:
* Eax: 637B7FC0:
* Ebx: 0000000A:
* Ecx: 637B7FC0:
* Edx: 00000000:
* Eip: 77387EAC: 8440108A 2BF975D2 33F633C6 D85539D2 5BFF8D0F 45290002
* Ebp: 61C1E848: 61C1E85C 7738A8E8 61C1EAAC 66F88B3C 61C1E86C 61C1EB14
* SegCs: 0000001B:
* EFlags: 00010206: 00450042 005F0052 0046004F 0050005F 004F0052 00450043
* Esp: 61C1E800: 016C5E3D 00000000 61C1F4B8 00000000 FFFFFFFF 00000000
* SegSs: 00000023:
* *******************************************************************************
* -------------------------------------------------------------------------------
* Short Stack Dump
77387EAC Module(USER32+00007EAC)
7738A8E8 Module(USER32+0000A8E8)
66F56AC1 Module(cwbodbc+00026AC1)
66F7EA51 Module(cwbodbc+0004EA51)
66F56DC9 Module(cwbodbc+00026DC9)
66F56D44 Module(cwbodbc+00026D44)
66F32EB2 Module(cwbodbc+00002EB2)
66F32BE6 Module(cwbodbc+00002BE6)
62104125 Module(ODBC32+00004125)
621041F3 Module(ODBC32+000041F3)
62D858D8 Module(msdasql+000058D8)
62D8B72F Module(msdasql+0000B72F)
62D8B68F Module(msdasql+0000B68F)
62D8B186 Module(msdasql+0000B186)
62D89A96 Module(msdasql+00009A96)
016C5E3D Module(sqlservr+006C5E3D)
016ABD5A Module(sqlservr+006ABD5A)
01698376 Module(sqlservr+00698376)
01656E53 Module(sqlservr+00656E53)
01E1FE2A Module(sqlservr+00E1FE2A)
010473A7 Module(sqlservr+000473A7)
0103D32C Module(sqlservr+0003D32C)
0103D23D Module(sqlservr+0003D23D)
0103D0C6 Module(sqlservr+0003D0C6)
0102DB52 Module(sqlservr+0002DB52)
0102E0D0 Module(sqlservr+0002E0D0)
0102C5F8 Module(sqlservr+0002C5F8)
010438E5 Module(sqlservr+000438E5)
01041C35 Module(sqlservr+00041C35)
0100889F Module(sqlservr+0000889F)
010089C5 Module(sqlservr+000089C5)
010086E7 Module(sqlservr+000086E7)
010D764A Module(sqlservr+000D764A)
010D7B71 Module(sqlservr+000D7B71)
010D746E Module(sqlservr+000D746E)

View 8 Replies View Related

RAISEERROR Not Throwing Exception In .NET

Jul 9, 2007

I am calling a stored procedure that looks like this.


Code:


ALTER PROCEDURE [dbo].[VerifyLogin]
-- Add the parameters for the stored procedure here
@Email nvarchar (100),
@Password nvarchar (200)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

DECLARE @Count int
DECLARE @Accounts int

SET @Accounts = (Select Count(*) from Users Where UPPER(Email) = UPPER(@Email))

IF @Accounts = 0
BEGIN
RAISERROR('E-mail address not found.', 10, 1)
END
ELSE
BEGIN
SET @Count = (Select Count(*) from Users Where UPPER(Email) = UPPER(@Email) and Password = @Password)

IF @Count > 0
select 1 as Verification
ELSE
select 0 as Verification
END
END



When I enter a login that does not exist, the error is not thrown in .net. Tracing the code shows normal execution. What am I doing wrong?

View 1 Replies View Related

' Question Throwing Exception

Aug 24, 2006

I have a comboBox with some names binded to it....With in the names some of them are like--- Store's Store, and like Danny's Gym...when i select names with ' in them i get this exception

Incorrect Syntax near 'S' Unclosed Question mark before the charectar string ORDER BY "SomeValue".....how could i go about fixing this?????

 

should i include some king of function that pulls out those quotes??? or what??? any help with this issue

 

 

View 3 Replies View Related

Bcp_sendrow Causing Unhandled Exception (0xC0000005: Access Violation Reading Location 0x00000123)

Jun 24, 2007

Hi,

Background:

This could be a simple C++ issue as I am not that familiar with the language. I am trying to prototype a small program to test the performance of inserting data using the BCP interface. I want to BCP data that my program generates and passes via program variables.



I have narrowed the issue down to a sprintf call. Following are two variations of the code - one that works and one that does not. The error happens when I try to execute the bcp_sendrow() call.



What is the appropriate way to create / send string data to the BCP interface. Any good examples available? I have created the following from the BulkCopyFromVariables example on the Microsoft SQL Server downloads site.



Thanks in advance, Kerry



---- Works ----




Code Snippet

for(idx=1; idx<=5; idx++){
//sprintf(k1, "%d", idx); //does not work...
sprintf(k1, "oo"); //works....

if ( (SendRet = bcp_sendrow(hdbc1) ) != SUCCEED ) {
printf("bcp_sendrow(hdbc1) Failed");
Cleanup();
return(9);
}
}






--- Causes Access Violation ----




Code Snippet

for(idx=1; idx<=5; idx++){
sprintf(k1, "%d", idx); //does not work...
//sprintf(k1, "oo"); //works....

if ( (SendRet = bcp_sendrow(hdbc1) ) != SUCCEED ) {
printf("bcp_sendrow(hdbc1) Failed");
Cleanup();
return(9);
}
}










--- Additional information ---

---------------------------
Target Table Definition
---------------------------



Code SnippetCREATE TABLE PtTest(
[ID] [int] IDENTITY(1,1) NOT NULL,
[PtID] [int] NOT NULL,
[ParamID] [nchar](10) NULL DEFAULT ((200)), --Above example trying to insert data here via k1 variable...
[ParamValue] [nchar](10) NULL DEFAULT ((200)),
[InsDate] [datetime] NULL DEFAULT (getdate()),
)


----------------------------




-----------------
Bind statements
-----------------



Code Snippet

int idx;
char k1[5];
char *terminator = "";


retcode = bcp_bind(hdbc1, (BYTE *)&idx, 0, sizeof(DBINT), NULL, 0, SQLINT4, 2);
if ( (retcode != SUCCEED) ) {
printf("bcp_bind(hdbc1) Failed");
Cleanup();
return(9);
}

retcode = bcp_bind(hdbc1, (BYTE *)&k1, 0, SQL_VARLEN_DATA, (UCHAR*)terminator, 1, SQLCHARACTER, 3);
if ( (retcode != SUCCEED) ) {
printf("bcp_bind(hdbc1) Failed");
Cleanup();
return(9);
}





Note: there are other bind statements...
-----------------

View 3 Replies View Related

CASE Statement Throwing Exception

Feb 26, 2008

I am using Compact Edition 3.5 against the Northwind.sdf database. The following SQL statement throws an error window in Visual Studio 2008 that states "The parameter is incorrect.". This only occurs when I have an input parameter inside the CASE statement.

**********************************************************************************************************
PLEASE DO NOT TELL ME I CAN JUST USE 'WHERE @CompanyName LIKE '%ABB%''
BECAUSE I UNDERSTAND THAT - I WANT TO KNOW WHY THE SYNTAX I HAVE IS
THROWING AN EXCEPTION
**********************************************************************************************************


This throws an exception when input parameter is in the CASE statement:
SELECT [Customer ID]
FROM Customers
WHERE (CASE WHEN @CompanyName LIKE '%ABB%' THEN 1 ELSE 0 END = 1)


This DOES NOT throw an exception (I know they do not get me the same results):

SELECT [Customer ID]
FROM Customers
WHERE (CASE WHEN [Company Name] LIKE '%ABB%' THEN 1 ELSE 0 END = 1)


TIA!

View 6 Replies View Related

Custom Report Renderer Throwing An Exception

Jan 31, 2008

I have to create a custom rendering extension for SQL Server 2005 Reporting Services.

I followed the instructions in the MSDN article: http://msdn.microsoft.com/msdnmag/issues/05/02/CustomRenderers/default.aspx

I am running the report server under an administrative account provileges on the local machine (XP Pro SP2).
The Reporting Services is installed for SQL Server 2005 Trial/Evaluation Edition (not expired yet) and has been upgraded to Service Pack 2.
The Report Manager runs under a default ASPNET account.

After deploying the extension according to instructions in the article, I see the custom renderer in the list of available rendering formats in the dropdown in the Report Manager.

However, when I select that renderer and click "Export", a new IE window opens with the following error message:


Server Error in '/Reports$SQLSERVER2005DEV' Application.


That assembly does not allow partially trusted callers.
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: System.Exception: That assembly does not allow partially trusted callers.

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:





[Exception: That assembly does not allow partially trusted callers.]

[Exception: An error occurred during rendering of the report.]

[Exception: An unexpected error occurred in Report Processing.]
Microsoft.Reporting.WebForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension) +503
Microsoft.Reporting.WebForms.ServerReport.InternalRender(Boolean isAbortable, String format, String deviceInfo, NameValueCollection urlAccessParameters, Stream reportStream, String& mimeType, String& fileNameExtension) +958
Microsoft.Reporting.WebForms.ServerReportControlSource.RenderReport(String format, String deviceInfo, NameValueCollection additionalParams, String& mimeType, String& fileExtension) +84
Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +143
Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +153
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64




Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433


My "why is it not working" question basically breaks down to 3 questions:

1. Why does this error say "partially trusted" whereas the new element in the rssrvpolicy.config file explicitly asks for "FullTrust" permissions?

2. Is there any deployment step that I'm missing?
[For now, it's:
- copy-and-paste the dll into ReportServerin directory;
- add a new CodeGroup element to the rssrvpolicy.config file;
- add a new Extension element to the rsreportserver.config file;
- IIS reset;
- Reporting Services service restart.]

3. Also, I checked the deployment instructions in BOL (Deploying Rendering Extension: http://msdn2.microsoft.com/en-us/library/ms154516.aspx), just to make sure I didn't miss anything.
An interesting this is, the BOL article does NOT mention a requirement for adding a new element into rssrvpolicy.config file.
Is this an error in the September 2007 Books Online?


The same error (regarding "partically trusted" - see above) occurs even after I signed the assembly with a strong name key (although this is not mentioned in the articles, but I figured it might be necessary).

Could someone point me in the right direction as to how to properly deploy a custom rendering extension, please?

Thanks a lot!

View 3 Replies View Related

Subreport Throwing An Exception When Placed In A Group Footer

Jul 24, 2006

I ran into this a few weeks ago and found that several others had as well, but no one had yet found an answer. I found the answer (at least one of the answers) this weekend and wanted to share it. I had recently added a subreport to a group footer in a table and started getting an error. Depending on the data, the error wasn't always present. I didn't have a problem when I moved the subreport to any other area in the report.

Here is the error I was getting:

An error occurred during local report processing

An internal error occurred on the report server. See the error log for more details.

It was a local report (rdlc), so naturally, there was no error log <g>. I added an event handler for ReportError and collected this information:

7/23/2006 5:18:22 PM
OS: Microsoft Windows NT 5.1.2600 Service Pack 2

*** EXCEPTION ***
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
Stack Trace: at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at SX.MainProgram.Main() in C:Documents and SettingsMYeagerMy DocumentsVisual Studio 2005ProjectsSXSXMainProgram.cs:line 22


*** INNER EXCEPTION ***
Message: Reporting Service Exception
Source: SX
Stack Trace: at SX.ReportSalesForm.reportViewer1_ReportError(Object sender, ReportErrorEventArgs e) in C:Documents and SettingsMYeagerMy DocumentsVisual Studio 2005ProjectsSXSXReportFormsReportSalesForm.cs:line 84
at Microsoft.Reporting.WinForms.ReportViewer.OnError(Exception e)
at Microsoft.Reporting.WinForms.ReportViewer.UpdateUIState(Exception e)
at Microsoft.Reporting.WinForms.ReportViewer.OnRenderingCompleteUI(ProcessThreadResult result, PostRenderArgs postRenderArgs)


*** INNER EXCEPTION ***
Message: An error occurred during local report processing.
Source: Microsoft.ReportViewer.WinForms
Stack Trace: at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at Microsoft.Reporting.WinForms.ProcessingThread.ProcessThreadMain(Object arg)


*** INNER EXCEPTION ***
Message: An internal error occurred on the report server. See the error log for more details.
Source: Microsoft.ReportViewer.Common
Stack Trace: at Microsoft.ReportingServices.Diagnostics.Utilities.RSTraceInternal.Assert(Boolean condition, String componentName)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteVariant(Object variant, Boolean convertDBNull)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteScopeTableValues(Object value)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteScopeTableValues(Object value)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteScopeLookupTable(ScopeLookupTable scopeTable)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteSubReport(SubReport subReport)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteReportItem(ReportItem reportItem)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteReportItemList(ReportItemList reportItems)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteReportItemCollection(ReportItemCollection reportItems)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteRectangle(Rectangle rectangle)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteReportItem(ReportItem reportItem)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteReportItemList(ReportItemList reportItems)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteReportItemCollection(ReportItemCollection reportItems)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteTableRow(TableRow tableRow)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteTableRowList(TableRowList rows)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteTableGroup(TableGroup tableGroup)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteTable(Table table)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteDataRegion(DataRegion dataRegion)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteReportItem(ReportItem reportItem)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteReportItemList(ReportItemList reportItems)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteReportItemCollection(ReportItemCollection reportItems)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteReport(Report report)
at Microsoft.ReportingServices.ReportProcessing.Persistence.IntermediateFormatWriter.WriteReportSnapshot(ReportSnapshot reportSnapshot)
at Microsoft.ReportingServices.ReportProcessing.ChunkManager.SnapshotChunkManager.SaveReportSnapshot(ReportSnapshot reportSnapshot)
at Microsoft.ReportingServices.ReportProcessing.ProcessingResult.Save()
at Microsoft.Reporting.LocalService.Render(PreviewItemContext itemContext, Boolean allowInternalRenderers, ParameterInfoCollection reportParameters, IEnumerable dataSources, DatasourceCredentialsCollection credentials, CreateAndRegisterStream createStreamCallback, ReportRuntimeSetup runtimeSetup, ProcessingMessageList& warnings)
at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)


This wasn't exactly enlightening, an exception in an ASSERT in the reporting services dll, but since I knew that results varied with different data, I tracked it down that way.

THE SOLUTION:

The problem occurs when data for group expression is null. If there is no subreport in the group footer, this isn't an issue, but if there is, you get the error. For instance, if your data comes from a SQL statement with a LEFT OUTER JOIN (as mine did), and the group expression uses a column that contains nulls as a result of the LEFT OUTER, this exception will be thrown. This one was VERY DIFFICULT to track down, but it's easily reproducable. It has nothing to do with what (if anything is) on the subreport, what the data the subreport uses looks like, whether there are parameters or not. It's purely having nulls in the data used by the group expression for the main report. I found that if I changed my SELECT from mytable.mycolumn to ISNULL(mytable.mycolumn, 0) the error went away.

Mike Yeager

View 5 Replies View Related

Throwing Exception In Stored Proc To Catch In C# And Rollback The Transaction

Sep 27, 2007




Hi,

I am using sql2k5. I just wanted to throw an error from stored procedure with some message to C# to rollback my transaction.
Here is how i wnated to do ( in sequence )

C#
=====
Open a connection
Begin the transaction
Execute the command

In the Stored Proc
===========
do multiple operations one by one
if error
stop processing further
Throw the error
C#
========
if exception
rollback the transaction
else
commit the transaction

I have tried using raise error in stored proc but never thrown exception

Can any one let me know how to achieve this scenario??

~Mohan Babu

View 5 Replies View Related

Row Data Can`t Be Set _ Native Exception

Oct 27, 2007



Dear brothers, still have problem with .net compact framework 1.1 (2003) when i try to sync the data between sqlce and sql server 2000 " not from the first time some times from several times of using the syncronization"

is there any services pack for sql ce

what is appropriate cab file(.NET COMPACT FRAMEWORK, SQLCE etc is ARMI,ARM4....) version for windows mobile 5 with intermec CN3 Device

View 2 Replies View Related

Merge Replication - Native Exception

Jan 11, 2006

Hi!

Here are the details:

- Merge replication is set up between SQL Server 2000 SP3 <-> SQL CE clients

- It is expected for the system to have 100-150 PDA users

- About 80-90 tables are being replicated. About half of the tables are for documents  that PDA users create. These tables have to be filtered by SUSER_SNAME() to minimize data transfered and not to allow users to see each others documents. For filtering we used join filters (now there is about 30-40 join filters)

- Tables shared by users have GUID primary key, while other tables have identity columns.

System seemed to work fine when number of tables and number of join filters was about half that it is now.

Now, occasionally we get Native exception 0x00000005 on the PDA after calling Synchronize method of the C# Replication object. Data is transfered to the server, but the application hangs.

In the documentation for SQL Server it is mentioned that performance may suffer from too many join filters so this may be the cause of our problem.

If this is source of the problem one solution would be to use simple horizontal filtering on all tables now included in the join filters (and to add username field to all these tables). We could also reduce number of join filters with denormalisation (which we are not inclined to do).

Any other suggestions? Is our assumption about the source of the error corect?

Can anyone give us some recommendations for database metrics (number of constraints, tables, join filters etc) that can (or do) work with sql ce merge replication.

Thanks!

View 5 Replies View Related

Using The Same Connection In Multiple Threads -&&> Native Exception

Jan 24, 2006

I found a peculiar thing today while working with SQL Mobile in a multithreaded application (VS2005, application for Pocket PC 2003).

I created a class which has one SqlCeConnection object. Every time I call a function to insert/select/delete something from the local db, I open the connection, execute the query an then close the connection again.

But when I'm calling a function from the db class in thread 1 and in the meantime call a different function (from the same db class of course) in thread 2, things go wrong. Because when function 1 wants to close the connection, function 2 is still using the connection and it will crash my application with a native exception (0xC0000005: access violation).

I can see why the error is happening, but shouldn't there be a nice .NET handled exception instead of a native exception which grinds my app to a hold?

(A workaround I use now is to use multiple connection objects instead of one, but I thought I'd give this feedback anyway)

View 5 Replies View Related

Native Exception On Column-Level In SQLCE

Nov 30, 2007

Hi,
I have developed a Smart Device Application using VB.NET 2003 on top of Windows Mobile 2003 platform which is running on Symbol PPT 8846, a model used in our construction sites for gathering data bar-coded on Pipes, trucks...etc. This application uses SQL CE as its back-end database and since its difficult to cover our sites with WI-FI coverage, most of the time the application is running offline. As for that, on a daily basis, synchronization is done in the offices before the system is released into sites. I have been doing several implementations in several projects and till now everything is running fine but until I got a native exception on exporting the data back into the server database. The server database or main database is using Fox Pro and this is what led me to build a Web Service for communication between SQL CE and Fox Pro. Anyways, going back to that mysterious exception, I did some of my intensive debug on what caused it. As a start, I went through the code line by line to check if there was a memory leak from P/Invokes; but I was shocked that the exception was raised from "SQLCEDataAdapter.Fill(Dataset)" function. First thought came to mind was to hard reset and to re-install the application but no luck. Since it was about SQLCE, I moved towards checking the data found in the SQLCE database and tried to de-fragment the data found under the table needed for export. What I mean by de-fragmenting is that I grouped the data under different classes or families and created different tables depending on these classes. Then tried exporting again and Bingo the data was exported except one record...That was so weird!! huh? (The database had 515 records)
So I went for the Query Analyzer to try to view that record but no hope, it was taking too long to view the record, I just left it for more than 15 minutes and still no response from the Analyzer...it was so strange since there was only one record in that table!!!?!!! As going further, I was so curious why this record causing that native and inability to be viewed by the Analyzer?? I did testing on the column-level of that record and found out that you can view all the columns except two : nvarchar(200) and nvarchar (20)....I was able to resolve this problem with an SQL statement to update both columns with empty or dummy values...!!!!!
But after this resolution, I really don't know how it could be controlled later on!! and why it happened??
I would be glad if anyone can give me any advise on why such problem popped out and especially on the column-level in SQL CE?? And how to overcome it?

Thanks for your time and effort,

Looking forward to hear from as soon as possible...


Just for Clarification:
.NET CF 1.0 SP3

SQLCE 2.0
were used

View 1 Replies View Related

A Native Exception Occurred: Synchronizing Data Between The MS SQL Server Database And PDA

Sep 27, 2005

ISSUE: While synchronizing data between the PDA and MS SQL Server database, using Active Sync connection, the sync process fails at times and displays an empty error message box and occasionally it shows the following exception:   Error During Synchronization: A native exception occurred. ExceptionCode:0xc0000005 ExceptionAddress:0x01627b28 Reading: 0x1e000000 OK to terminate CANCEL to debug   Moreover the .SDF file on the PDA gets corrupted. The ActiveSync connection drops as soon as the sync process fails. Later when the .SDF file is deleted and restored the synchronization is successful. Note: The replication monitor in the SQL Server indicates that the synchronization was successful even when the above error occurs.

View 3 Replies View Related

Help With Installation Error Code 3221225477 0xc0000005

Feb 21, 2008

I assume I'm trying to install SQL Server Express 2005 as it's part of a larger installation package (Neat Receipts Professional 3.0.3).

During the installation of SQL Server 2005, I get the following error message:

The SQL Server System Configuration Checker cannot be executed due to WMI configuration on the machine ACERLAPTOP Error:3221225477 (0xc0000005)

I'm running XP Home SP2 with all known patches applied.
CPU is AMD Athlon Turion(TM) 64 Mobile Technology ML-30, 1600 MHz
I'm also running ZoneAlarm Security Suite Pro for firewall and antivirus.
If further information is needed, just ask.

Does anyone have a suggestion as to how to get past this obstacle?

Ira Smilovitz

View 1 Replies View Related

SQL Server Comact Error 0XC0000005 After Device Is Powered Off And Back On

Mar 12, 2008

This is my first attempt to use SQL Server Compact with Visual Studio 2005.

I wrote a program for Inventory Scaning which requires the database to be stored on an SD Card. As long as the device is left powered on, the programs function normally. However, if the device powers off and is then turned back on the 0xC0000005 error is displayed when the program attempts to do anything with the SQL Connection.

I have also written a small sample program to test and the results are repeatable each time.

The sample program consists of a single form with six buttons (Create Database, Open Database, Insert Records, Delete Records, Close Database, Dispose Database).

Both programs are written in VB.

Here is the code for the sample program.


Public Class frmSQLTest


Private cnDB As System.Data.SqlServerCe.SqlCeConnection

Private connString As String


Private Sub frmSQLTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.txtDB.Text = "Storage CardTest.sdf"

End Sub


Private Sub txtDB_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDB.LostFocus

connString = "Data Source=" & Me.txtDB.Text

Me.txtStatus.Text = "Connection String Set"

End Sub


Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click

If Me.txtDB.Text = Nothing Then

MessageBox.Show("Unable to Create Database")

Exit Sub

End If

Dim eng As New System.Data.SqlServerCe.SqlCeEngine(connString)

eng.CreateDatabase()

eng = Nothing

Me.txtStatus.Text = "Database Created"

End Sub


Private Sub btnOpenDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenDB.Click

Dim sqlDB As New System.Data.SqlServerCe.SqlCeCommand

If cnDB Is Nothing Then

cnDB = New System.Data.SqlServerCe.SqlCeConnection(connString)

End If

cnDB.Open()

Me.txtStatus.Text = "Database Opened"

sqlDB.Connection = cnDB

sqlDB.CommandText = "CREATE TABLE Master (Item nvarchar(12), Description nvarchar(19))"

sqlDB.ExecuteNonQuery()

sqlDB.CommandText = "CREATE INDEX idx_Master on Master (Item)"

sqlDB.ExecuteNonQuery()

Me.txtStatus.Text = "Master Table Created"

sqlDB = Nothing

End Sub


Private Sub btnInsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsert.Click

Dim RecCount As Long

Dim sqlDB As New System.Data.SqlServerCe.SqlCeCommand

sqlDB.Connection = cnDB

For RecCount = 1 To Me.nudRecs.Value

sqlDB.CommandText = "INSERT INTO Master ([Item], [Description]) " _

& "VALUES ('" & RecCount.ToString & "','Test Item " & RecCount.ToString & "')"

sqlDB.ExecuteNonQuery()

If RecCount Mod 100 = 0 Then

Me.txtStatus.Text = "Updating Record..." & RecCount.ToString

End If

Next

Me.txtStatus.Text = "Records Inserted"

sqlDB = Nothing

End Sub


Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click

Dim sqlDB As New System.Data.SqlServerCe.SqlCeCommand

sqlDB.Connection = cnDB

sqlDB.CommandText = "Delete FROM Master"

Me.txtStatus.Text = "Master Table Cleared"

sqlDB = Nothing

End Sub


Private Sub btnCloseDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCloseDB.Click

cnDB.Close()

Me.txtStatus.Text = "Database Closed"

End Sub


Private Sub btnDispose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDispose.Click

cnDB = Nothing

System.IO.File.Delete(Me.txtDB.Text)

Me.txtStatus.Text = "Database Diposed"

End Sub


End Class

In my tests, I start the program (loaded on the Storage Card in the same directory as the database). SQL Server Compact is also installed on the SD Card to save space in Main Memory.

Steps to Re-Create the Error:

1. Click the Create Database button. Database is created properly.
2. Click the Open Database button. Database connection opens properly.
3. Click the Insert Records button. Records are inserted into the table properly.
4. Turn off the Symbol MC3000 unit.
5. Turn the unit back on.
6. When I click on any of the following buttons, the error is displayed. Close Database, Insert Records, Delete Records.

I have also tried closing the database (as well as closing and disposing the database) prior to step 4 above, but when I try to re-open the database (or create the database) again, the error displays.

Is there anyway to correct this issue?

With the real program, the database must be kept open as long as each form is open to prevent speed issues and the database must be stored on the SD Card since there is not enough storage space available on the device.

View 3 Replies View Related

Sql Agent Throwing Config Error I'm Not Using

Feb 20, 2008

OK so I have this SSIS package that uses a connection call "Conn1". I added this to my configuration file (which also contains connections called "Conn2" and "Conn3" which are used by other packages. Works fine in DEV when run via SQL Agent. I moved SSIS package and config file to prod server. SQL Agent now throws error on this package saying it cannot resolve path to "Conn3". This package doesn't use "Conn3"... I opened both the SSIS package and the Config file in notepad and verified Conn3 wasn't referenced in the package... HELP !!!!

View 3 Replies View Related

Analysis :: MDX-Query Throwing Error

Nov 18, 2015

I am new to SSAS and learning mdx, I am running the following query but it is throwing error "Parser: The syntax for 1 is incorrect",

Select [Measures].[Order Quantity] on axis(0),
[DimProduct].[Product By Category].[ProductCategory].members on axis(1)
From [ResellerSales]
where
Except({[DimProduct].[Product By Category].[ProductCategory].members},
{[DimProduct].[Product By Category].[ProductCategory].&[1]})

View 6 Replies View Related

ASP.Net, SQL, Using Datetime Objects As Variables (keeps Throwing Error)

Feb 20, 2008

Sorry seem to be havign no end of trouble with SQL today. I need to create a query that will rank tickets using the row count of another table which has a relationship with the primarykey of that ticket table. I decided to spilt it into two querys, one which gets the count each ticketid has within a date peroid and relating to a os:: SELECT     COUNT(*) AS count, Tickets.TicketID, Systems.OSFROM         Rating INNER JOIN                      Tickets ON Rating.TicketID = Tickets.TicketID INNER JOIN                      Systems ON Tickets.SystemID = Systems.SystemIDWHERE     (Rating.DateVoted >= @date)GROUP BY Tickets.TicketID, Systems.OSHAVING      (Systems.OS = @osid) This works, BUT when I put in the date using: command.CommandText = "SELECT COUNT(*) AS count, Tickets.TicketID, Systems.OS FROM Rating INNER JOIN Tickets ON Rating.TicketID = Tickets.TicketID INNER JOIN Systems ON Tickets.SystemID = Systems.SystemID WHERE (Rating.DateVoted >=" + Datetime.Now.Adddays(-7) + ") GROUP BY Tickets.TicketID, Systems.OS HAVING (Systems.OS =" + 1 + ")"; And it throws up an error saying there was a syntax error at '22' (the hour I am currently on). So: Any idea how I can fix thisAny ideas on creating a query that will do the above, but also return the ticket informationHow do you link querys (I might have to do this if I can't work out 2)Please, If anyone has any ideas. This is driving me crazy 

View 5 Replies View Related

Typed Dataset Schema Throwing Error

Apr 8, 2006

Hello,I'm using a typed dataset to access my database (SQL Express); I have a table that returns data, which two fields are null; I'm getting this error:{"Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."}There are no foreign-key or unique key constraints, so it has to be a non-null issue; I changed the two fields in the table to have a null value of Empty instead of Throw Exception, but I don't understand what the problem is coming from...  I'm at a loss.Thanks.

View 2 Replies View Related

Ole Db Source Editor Preview Throwing An Error

Sep 2, 2006

i have a data flow configured to use a ole db source.  the ole db source uses an ole db connection manager pointing to the adventureworks db which suceeded when i tested its connection.  the data access mode of the ole db source is "sql command".  below is the sql command text:

SELECT SpecialOfferID, Description
DiscountPct, Type, Category, StartDate,
EndDate, MinQty, MaxQty, ModifiedDate
FROM Sales.SpecialOffer
WHERE ModifiedDate >= ? AND ModifiedDate < ?

this query uses 2 paramaters, each of which is mapped to a datetime variable which falls with the range of the ModifiedDate column as follows:

Parameter0: User::ExtractStartDate

Parameter1: User::ExtractStopDate

ExtractStartDate is set to 7/1/2001 and ExtractStopDate is set to 3/31/2004.  however, i get the following error when i press the preview button in the ole db source editor: "there was an error displaying the preview. additional information: no value given for one or more required parameters (microsoft sql native client)".

as far as i can tell, i have the ole db source configured correctly.  thus, i can't figure out why this error is being generated.  has anyone else experienced this issue?  if so, were you able to resolve it? is this a bug?

thanks in advance.

 

View 5 Replies View Related

Merge Replication Throwing Very Weird Error Messages

Mar 2, 2007

I've been setting up subscriptions to a merge publication for the past 3 days. All of a sudden, I'm getting a pile of very strange errors. Replication is configured. I have 16 subscribers to an existing publication configured and synchronizing changes without any issues. The script that I'm using to create all of the subscriptions is as follows:

use [PIC]

exec sp_addmergesubscription @publication = N'PIC', @subscriber = N'machinenameSQLEXPRESS',

@subscriber_db = N'MyDatabase', @subscription_type = N'Push', @sync_type = N'Automatic',

@subscriber_type = N'Global', @subscription_priority = 75, @description = N'', @use_interactive_resolver = N'False'

exec sp_addmergepushsubscription_agent @publication = N'PIC', @subscriber = N'machinenameSQLEXPRESS',

@subscriber_db = N'MyDatabase', @job_login = null, @job_password = null, @subscriber_security_mode = 1,

@publisher_security_mode = 1, @frequency_type = 64, @frequency_interval = 0, @frequency_relative_interval = 0,

@frequency_recurrence_factor = 0, @frequency_subday = 0, @frequency_subday_interval = 0, @active_start_time_of_day = 0,

@active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 0

GO

The last one that I added #17, gives the following errors after successfully creating the subscription.

Command attempted:


{call sys.sp_MSmergesubscribedb ('true', 0) }

Error messages:


The merge process could not initialize the subscription. Ensure that the subscription registration exists at the publisher, and reregister the subscription if necessary. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201011)
Get help: http://help/MSSQL_REPL-2147201011

RegCreateKeyEx() returned error 5, 'Access is denied.' (Source: MSSQLServer, Error number: 22002)
Get help: http://help/22002

Could not add article resolver 'Microsoft SQL Server Additive Conflict Resolver' information to the registry (Source: MSSQLServer, Error number: 21713)
Get help: http://help/21713

Could not register article resolver: 'Microsoft SQL Server Additive Conflict Resolver'. (Source: MSSQLServer, Error number: 21715)
Get help: http://help/21715

The system tables for merge replication could not be created successfully. (Source: MSSQLServer, Error number: 20008)
Get help: http://help/20008

I've tried to manually create it using the GUI and get an even stranger error message as follows:

TITLE: New Subscription Wizard
------------------------------

Microsoft SQL Server Management Studio is unable to access replication components because replication is not installed on this instance of SQL Server. For information about installing replication, see the topic Installing Replication in SQL Server Books Online.

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.06&EvtSrc=Microsoft.SqlServer.Management.UI.ReplUtilitiesErrorSR&EvtID=ReplicationNotInstalled&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

Replication components are not installed on this server. Run SQL Server Setup again and select the option to install replication. (Microsoft SQL Server, Error: 21028)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=21028&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------


I very obviously have replication installed by virtue of the fact that I have a publication and 16 subscriptions that are currently synchronizing. Any ideas?

View 3 Replies View Related

SSIS Load From Server Throwing Non-specific Error

Apr 11, 2008

My BIDS installation is able to create new projects and open saved ones, but if i try to add an existing package from a remote server, it throws the error pasted below. I can see the package list, but once i choose the package, hit ok, then hit ok to load it, I get the error. I can open the same package on a different computer, so it's not user rights related. Below the error is version info. Thanks in advance for any help you might be able to give!

===================================
One or more error occurred. There should be more specific errors preceding this one that explains the details of the errors. This message is used as a return value from functions that encounter errors.
(Microsoft Visual Studio)
------------------------------
Program Location:
at Microsoft.SqlServer.Dts.Runtime.Application.LoadFromSqlServer(String packagePath, String serverName, String serverUserName, String serverPassword, IDTSEvents events)
at Microsoft.DataTransformationServices.Controls.PackageProtectionUtils.<>c__DisplayClassa.<LoadPackageFromSql>b__9(String password, IDTSEvents events)
at Microsoft.DataTransformationServices.Controls.PackageProtectionUtils.LoadPackageWithPassword(PackageLoader loader, IWin32Window dialogParent, String& packagePassword)
at Microsoft.DataTransformationServices.Controls.PackageProtectionUtils.LoadPackageFromSql(String packagePath, String server, String sqlUserName, String sqlServerPassword, IWin32Window dialogParent, String& packagePassword)
at Microsoft.DataTransformationServices.Controls.PackageLocationControl.LoadPackage(String& packagePassword)
at Microsoft.DataTransformationServices.Project.Controls.AddExistingPackageForm.AddExistingPackage()
at Microsoft.DataTransformationServices.Project.Controls.AddExistingPackageForm.AddExistingPackageForm_FormClosing(Object sender, FormClosingEventArgs e)
===================================
One or more error occurred. There should be more specific errors preceding this one that explains the details of the errors. This message is used as a return value from functions that encounter errors.

------------------------------
Program Location:
at Microsoft.SqlServer.Dts.Runtime.Wrapper.ApplicationClass.LoadFromSQLServer(String bstrPackagePath, String bstrServerName, String bstrServerUserName, String bstrServerPassword, Boolean bLoadNeutral, IDTSEvents90 pEvents)
at Microsoft.SqlServer.Dts.Runtime.Application.LoadFromSqlServer(String packagePath, String serverName, String serverUserName, String serverPassword, IDTSEvents events)




Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)
Microsoft .NET Framework
Version 2.0.50727

Installed Edition: IDE Standard
Microsoft Visual Studio 2005 Tools for Applications

SQL Server Analysis Services
Microsoft SQL Server Analysis Services Designer
Version 9.00.3042.00

SQL Server Integration Services
Microsoft SQL Server Integration Services Designer
Version 9.00.3042.00

SQL Server Reporting Services
Microsoft SQL Server Reporting Services Designers
Version 9.00.3042.00

View 1 Replies View Related

Integration Services :: SSIS 2012 Script Always Throwing Same Error

Nov 14, 2013

I am writing the following code in my SSIS 2012 script task.I am deliberately trying to fali this code by adding some typos in the connection string.I want to catch the exception and display the exact exception message.but SSIS runtime is always throwing same error message as follows:

Exception has been thrown by the target of an invocation.

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()

Below is the code
  
public void Main()
  {
    //TODO: Add your code here
            try
            {
                SqlConnection conn = new SqlConnection("Data Source=apsed1674;Integrated Security=true;database=EDX");
             
[Code] ....

View 9 Replies View Related

Throwing Error When Querying The Image Of Database In SQL Server 2000.

Oct 3, 2007



I created an Image for the Database in sqlserver 2000. When I am querying directly the database as "Select * from employee", it is returning the result set.

But, when I am querying Database image with same query. It is giving error

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'Employee'

It is expecting the Database Owner. If I do query like "Select * from [Owner].employee", it is working fine.

My requirement is not use owner in queries, it should be simple query ("Select * from employee").


Can any one, help me out.
Thanks in advance.
Bhupesh

View 1 Replies View Related

Custom Data Flow Task Throwing Error When Run From Command Prompt

Jan 17, 2007



Hi,

I developed a custom data flow task in .net 2.0 using Visual Studio 2005. I installed it into GAC using GACUTIL and also copied it into the pipeline directory. This task runs absolutely fine when I run it on my local machine both in BIDS and using the script in windows 2000 environment. However, when I deployed this package into a windows 2003 server, the package fails at the custom task level. I checked the GAC in windowsassembly directory and it is present. Also I copied the file into the PipeLine directory and verified that I copied it into the correct pipeline directory by checking the registry. The version of the assembly is still Debug. I looked up documentation in MSDN but there is very little information about the errors I am seeing.

The error I get is pasted below, Can somebody please help me as I am currently stuck and running out of ideas to fix this problem.

Code: 0xC0047067

Source: DFT Raw File DFT Raw File (DTS.Pipeline)

Description: The "component "_" (2546)" failed to cache the component metadata object and returned error code 0x80131600.

Code: 0xC004706C

Source: DFT Raw File DFT Raw File (DTS.Pipeline)

Description: Component "component "_" (2546)" could not be created and returned error code 0xC0047067. Make sure that the component is registered correctly.

View 6 Replies View Related

SqlDMO Connect Error From Microsoft Operations Manager (MOM)

Nov 21, 2006

MOM connects to 19 instances without issue and fails on one (1). The failing instance resides on a server with two(2) other instances that do not fail. Security is setup the same on windows and sqlserver.

Receiving error in MOM:
"Could not connect using SQLDMO to SQL Instance WEB. However, the instance is currently running."

Presents in Event Viewer as:
"18452: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."

Troubleshooting so far:
Created simple SqlDMO VBScript that uses a trusted connection. This works fine from my desktop to all twenty (20) instances yet fails on the one server that MOM is running on.



Any ideas?

View 1 Replies View Related

ERROR [HY000] Or ERROR [23000] At Random Times When Using Sql Native Client Via ODBC

Apr 16, 2008

The following (VB.Net) code causes exceptions at seemingly random times.
Any suggestions?
Not sure if the problem is in .Net's ODBC support or in Sql Native Client.

If MARS is off, usually after less than 100 loops:



Code Snippet

System.Data.Odbc.OdbcException was unhandled
ErrorCode=-2146232009
Message="ERROR [HY000] [Microsoft][SQL Native Client]Connection is busy with results for another command"
Source="SQLNCLI.DLL"
Turning MARS is on bypasses that error, so it will sometimes survive a thousand or so runs before hitting:




Code Snippet

System.Data.Odbc.OdbcException was unhandled
ErrorCode=-2146232009
Message="ERROR [23000] [Microsoft][SQL Native Client][SQL Server]Cannot insert the value NULL into column 'Number', table 'tempdb.dbo.#TempTable___..(shortened to fit).. _________000000002F3F'; column does not allow nulls. INSERT fails.
Source="SQLNCLI.DLL"
Code here:
(Console Application, empty database,
Visual Studio 2005, .Net 2.0, Windows XP,SQL Server 2005 or SQL Express 2005, Local or Remote)





Code Snippet

Module Module1

Sub Main()

'Dim connection As New SqlClient.SqlConnection("database=TestDB;server=.sqlexpress;Integrated Security=SSPI;") 'Doesn't crash
'Dim connection As New OleDb.OleDbConnection("Provider=SQLNCLI;database=TestDB;Server=.sqlexpress;Trusted_Connection=yes;") 'Doesn't crash

'Dim connection As New Odbc.OdbcConnection("Driver={SQL Native Client};Database=TestDB;Server=.sqlexpress;Trusted_Connection=yes;") 'Crashes
Dim connection As New Odbc.OdbcConnection("Driver={SQL Native Client};Database=TestDB;Server=.sqlexpress;Trusted_Connection=yes;MARS_Connection=yes") 'Crashes

VBMath.Randomize()

Dim run_count As Integer = 1
connection.Open()
Console.WriteLine("Connected!!")

While True
'connection.Open()

Dim testcmd As New Odbc.OdbcCommand("CREATE TABLE [#TempTable] (Number int PRIMARY KEY)", connection)
testcmd.ExecuteNonQuery()
testcmd.Dispose()
testcmd = Nothing

Dim dtTemp As New DataTable
Dim daTemp As New Odbc.OdbcDataAdapter("SELECT * FROM [#TempTable]", connection)
daTemp.MissingSchemaAction = MissingSchemaAction.AddWithKey
daTemp.Fill(dtTemp)
Dim cbTemp As New Odbc.OdbcCommandBuilder(daTemp)
Dim viewTemp As New DataView(dtTemp, Nothing, "Number", DataViewRowState.CurrentRows)

Dim i As Integer
For i = 1 To 1000
Dim test_number As Integer = CInt(Rnd() * 2000)
If viewTemp.Find(test_number) = -1 Then 'Keep it unique
Dim new_temp_row As DataRowView = viewTemp.AddNew()
new_temp_row("Number") = test_number
new_temp_row.EndEdit()
End If
Next

daTemp.Update(dtTemp)

'daTemp.Dispose()
'daTemp = Nothing

'cbTemp.Dispose()
'cbTemp = Nothing

'dtTemp.Dispose()
'dtTemp = Nothing

'viewTemp.Dispose()
'viewTemp = Nothing


Dim testcmd2 As New Odbc.OdbcCommand("DROP TABLE [#TempTable]", connection)
testcmd2.ExecuteNonQuery()
testcmd2.Dispose()
testcmd2 = Nothing

'connection.Close()
'GC.Collect()

'Console.Write(".")
run_count += 1
End While

End Sub

End Module

Usually the ".Update" triggers the exception, but sometimes the other sql commands do it.
Have tried various experiments with disposing of objects immediately when finished, but no effect.
Opening and closing the connection each loop seems to delay the errors, but it still happens eventually.

View 7 Replies View Related

RDA - Vb 2005 App - Desktop &&amp; Pocket Pc Emulator - Error: 80072F76 Native Error: 28035

Oct 12, 2006

RDA - vb 2005 app - desktop & pocket pc emulator - error: 80072F76 native error: 28035

PDA info:
.NET CF 1.0 env-string...
MS SQL client
MS SQLCE 2.0 dev
MS SQLCE 2.0

DESKTOP info:
Microsoft SQL Server Management Studio Express 9.00.2047.00
Microsoft Data Access Components (MDAC) 2000.085.1117.00
(xpsp_sp2_rtm.040803-2158)
Microsoft MSXML 2.6 3.0 6.0
Microsoft Internet Explorer 6.0.2900.2180
Microsoft .NET Framework 2.0.50727.42
Operating System 5.1.2600

copied an app from http://www.codeproject.com/netcf/PocketPCwithSQLCE/PocketPCwithSQLCE_Src.zip
modified its CONFIG.XML to...
<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
<DatabaseServer>192.168.1.89</DatabaseServer>
<DatabaseName>D1Temp</DatabaseName>
<DatabaseLogin>sa</DatabaseLogin>
<DatabasePassword></DatabasePassword>
<SQLCEURL>http://192.168.1.89/SqlMobile/sqlcesa30.dll</SQLCEURL>
<LocalDBConnect>Provider=Microsoft.SQLServer.OLEDB.CE.2.0; Data Source=My DocumentsMyFav.sdf;</LocalDBConnect>

<LocalDBLocation>My Documents</LocalDBLocation>
<LocalDBName>MyFav.sdf</LocalDBName>
<IISLogin>192.168.1.89/Jason</IISLogin>
<IISPassword>batman2005</IISPassword>
</Configuration>

error is "Header information is either corrupted or missing. [,,, header name,,]"

have spent weeks google-ing trying to get this to work, to no avail.
Has ANYONE got RDA PULL to work with above setups?

View 1 Replies View Related

'((System.Exception)($exception)).Message' Threw An Exception Of Type 'System.NotSupportedException'

Jan 16, 2008

Greetings everyone, I am attempting to build my first application using Microsofts Sql databases. It is a Windows Mobile application so I am using Sql Server Compact 3.5 with Visual Studio 2008 Beta 2. When I try and insert a new row into one of my tables, the app throws the error message shown in the title of this topic.
'((System.Exception)($exception)).Message' threw an exception of type 'System.NotSupportedException'



My table has 4 columns (i have since changed my FavoriteAccount datatype from bit to Integer)
http://i85.photobucket.com/albums/k71/Scionwest/table.jpg

Account type will either be "Checking" or "Savings" when a new row is added, the user will select what they want from a combo box.

Next is a snap shot of my startup form.
http://i85.photobucket.com/albums/k71/Scionwest/form.jpg



Where it says "Favorite Account: None" in the top panel, I am using a link label. When a user clicks "None" it will go to a account creation wizard, and set the first account as it's primary/favorite. As more accounts are added the user can select which will be his/her primary/favorite. For now I am just creating a sample account when the label is clicked in an attempt to get something working. Below is the code used.


private void lnkFavoriteAccount_Click(object sender, EventArgs e)

{

FinancesDataSet.BankAccountRow account = this.financesDataSet.BankAccount.NewBankAccountRow();

account.Name = "MyBank Checking Account";

account.AccountType = "Checking";

account.Balance = Convert.ToDecimal("15.03");

account.FavoriteAccount = 1;//datatype is an integer, I have changed it since I took the screenshot.

financesDataSet.BankAccount.Rows.Add(account);
//The next three lines where added while I was trying to get this to work.
//I don't know if I really need them or not, I receive the error regardless if these are here or not.



this.bankAccountTableAdapter1.Update(financesDataSet);

this.financesDataSet.AcceptChanges();

refreshDatabase();

}


the refreshDatabase() code is here:


private void refreshDatabase()

{

this.bankAccountTableAdapter1.Fill(this.financesDataSet.BankAccount);

//Aquire a count of accounts the user has

int numAccounts = financesDataSet.BankAccount.Count;

//Loop through each account and see which one is the primary.

for (int num = 0; num != numAccounts; num++)

{
//Works ok in frmMain_Load, but when my lnkFavoriteAccount_click calls this, it throws the error.

if (this.financesDataSet.BankAccount[num].FavoriteAccount == 1)

{
//Display the primary account on our home page. User can click the link label & be taken to their account register.

this.lnkFavoriteAccount.Text = this.financesDataSet.BankAccount[num].Name.ToString();

this.lnkFavoriteFunds.Text = this.financesDataSet.BankAccount[num].Balance.ToString();

break;

}

}

}


and my form_load code

private void frmMain_Load(object sender, EventArgs e)

{

refreshDatabase();

}


So, when I click on the lnkFavoriteAccount label, and my new row gets added, the app stops at the following line in my DataSet.Designer

[global:ystem.Diagnostics.DebuggerNonUserCodeAttribute()]

public byte FavoriteAccount {

get {

try {

return ((byte)(this[this.tableBankAccount.FavoriteAccountColumn]));

}

catch (global:ystem.InvalidCastException e) {
//Stops at the following line, this error was caused by 'if (this.financesDataSet.BankAccount[num].FavoriteAccount == 1)'

throw new global:ystem.Data.StrongTypingException("The value for column 'FavoriteAccount' in table 'BankAccount' is DBNull.", e);

}

}

set {

this[this.tableBankAccount.FavoriteAccountColumn] = value;

}

}


I have no idea what I am doing wrong, all of the code I used I retreived from Microsofts help documentation included with VS2008. I have tried used my TableAdapter.Insert() method and it still failed when it got to

if (this.financesDataSet.BankAccount[num].FavoriteAccount == 1)

in my refreshDatabase() method it still failed.

When I look, the data has been added into the database, it's just when I try to retreive it now, it bails on me. Am I retreiving the information wrong?

Thanks for any help you guys can offer.

Johnathon

View 1 Replies View Related

Native Error 18456 !!!! Help!!!!

Feb 22, 2008

Hi all,

Ms SQL Server Native Error 18456 !! Login Failed.

Pls help me out.

Thanx in Advance

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved