'((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


ADVERTISEMENT

The Script Threw An Exception: Exception Of Type 'System.OutOfMemoryException' Was Thrown.

Jan 31, 2007

Hi,

I got an strange problem with one of my packages.

When running the package in VisualStudio it runs properly, but if I let this package run as part of an SQL-Server Agent job, I got the message "The script threw an exception: Exception of type 'System.OutOfMemoryException' was thrown." on my log and the package ends up with an error.

Both times it is exactly the same package on the same server, so I don't know how the debug or even if there is anything I need to debug?

Regards,

Jan

View 2 Replies View Related

Deployment Of Model And DSV --&&> Exception Of Type 'System.NotSupportedException' Was Thrown.

Mar 17, 2008

I starting getting the error above today when attempting to deploy updated DSV's and Report models. I can't seem to locate any info about this error - seems like a generic one. We're on 2005 SP1 (think we're on build 2221). Any help is appreciated!

View 5 Replies View Related

SQLConnection Threw Exception Of Type System.InvalidOperationException

Mar 4, 2008

My SqlConnection is causing an error "sqlConn.ServerVersion threw an exception of type System.InvalidOperationException". Everything I have read seems to suggest that there is a problem with my SQLConnection parameters but as you can see from the commeted code below I have tried three different servers with four different configurations.  I am out of ideas on what is causing the error. 
Thanks - Amy
Here is a section of my code:
String sqlStmt = "Select [UserName], [Password], [Last], [First] from Contacts Where Login=@Uid AND Password=@Pwd";
SqlConnection sqlConn = new SqlConnection("Data Source=localhost;Initial Catalog=test;Integrated Security=SSPI;");//SqlConnection sqlConn = new SqlConnection("Data Source=pe2800;Initial Catalog=test;Integrated Security=SSPI;");//SqlConnection sqlConn = new SqlConnection("Data Source=HorizonDC02;Initial Catalog=test;Integrated Security=SSPI;");//SqlConnection sqlConn = new SqlConnection("Data Source=HorizonDC02;Initial Catalog=test;User ID=username;Password=password;");
SqlCommand sqlCmd = new SqlCommand(sqlStmt, sqlConn);sqlCmd.Parameters.Add("@Uid", SqlDbType.VarChar, 30).Value = uid;sqlCmd.Parameters.Add("@Pwd", SqlDbType.VarChar, 30).Value = pwd;sqlCmd.Connection.Open();

View 2 Replies View Related

A First Chance Exception Of Type 'System.Data.SqlClient.SqlException' Occurred In System.data.dll

Jan 18, 2008

Hi,
I've written this code multiple times now. But for the first time i get an error at the line underlined. My procedure runs perfectly when i execute it through Sql Query analyzer.
plzz help.. Its urgent and am unable to find the reason for this error "A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll"
Thanks !SqlConnection conn = new SqlConnection(DbConnectionString);
conn.Open();
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "dbo.rqryTradesPRR";
cmd.Parameters.Add("@COBDate",SqlDbType.DateTime).Value = "2002-10-31 00:00:00.000" ;
SqlDataReader reader = cmd.ExecuteReader();
while(reader.Read())
{
// have written something here

}
 Thanks in advance !
 

View 2 Replies View Related

BIDS: Exception Of Type 'System.OutOfMemoryException' Was Thrown.

Mar 3, 2008

All,

I have a large package (I know the recommendation is to have one package per data flow.) It has 20+ data flows in it. Personally I have found it much too complex to manage dozens of packages just because I want to have more than one data flow in my package.

I have been working on this package in an iterative manner over the past several months. Recently, I noticed I started getting the error message: "Exception of type 'System.OutOfMemoryException' was thrown" when I went to save my package. This is _extremely_ frustrating, because when this happens, all the changes I have made are generally lost. Occasionally, I have noticed if I close some other BIDS windows, or just wait a bit, I will be able to click save again, and it will actually save. Usually, I am forced to just "end-task" Visual Studio.

Other than splitting the package up into 20 separate packages, is there a way around this problem? I would rather put up with the lost changes than switch to dealing with 20 separate packages. It just makes things to difficult to manage when everything is split up into so many packages - particularly when I am passing variables around from parent to child packages.

Please help!

Thanks,

David Baldauff

View 13 Replies View Related

Error From System.Data.SqlServerCe.SqlCeCommand.ProcessResults() - ** No Exception Message Returned **

May 7, 2008

I have an app running Windows CE 5.0 and SqlServerCE 3.0. Occasionally, one of the production units will throw an exception with the following stack trace but no exception message:

Exception Msg:

Stack Trace: at System.Data.SqlServerCe.SqlCeCommand.ProcessResults()
at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand()
at System.Data.SqlServerCe.SqlCeCommand.ExecuteReader()
at System.Data.SqlServerCe.SqlCeCommand.ExecuteReader()
at XX.MobileApp.frmXXX.LoadData()


This is not something that I have been able to reproduce in our shop. I even take their database and run it here in our shop with out such errors. Does anyone know some possible causes for this error?


Sorry, I don't have more info to give becuase this is all I have to work with since I cannot reproduce in our shop. If the exception object exposes a property for the HResult, I would be able to provide that.

I appreciate your repsonses.

View 1 Replies View Related

Deserialization Failed: The Type Initializer For 'Microsoft.ReportDesigner.Drawing.RptStyleConstValue' Threw An Exception

Sep 26, 2006

I have VS2003 and VS2005 installed as well as SQL Server 2000 and SQL Server 2005 Tools. I have RS2000 and RS2005 installed. RS2000 works fine in VS2003. When using VS2005 and opening a Microsoft sample project for 2005, I get the error listed in the subject line.

When trying to create a new project and connecting to an Oracle database or a SQL Server 2005 database, I get the following error: "A connection cannot be made to the database. Set and check the connection string." The connection works fine when the test button is clicked, but fails when continuing in the wizard.

Any suggestions. We are trying to migrate from RS2000 to RS2005 and nothing in 2005 works.

View 6 Replies View Related

Failed To Load Expression Host Assembly. Details: The Type Initializer For 'CableReporting.Utilities' Threw An Exception

Sep 18, 2007

Hi

I am using sql reporting service 2005 with .NET 2.0.
I have created a custom dll file for report and put this dll in appropriate folder.
Report is running fine in designer project.
but when I am trying to view this report after uploading to report manager it give me an error like


Failed to load expression host assembly. Details: The type initializer for 'CableReporting.Utilities' threw an exception. (rsErrorLoadingExprHostAssembly)Is there any solution for that?

thanks and Regards

Apurv Shah
IBM India pvt Ltd

View 3 Replies View Related

The Script Threw An Exception! URGENT

Aug 21, 2007



I have a very simple SSIS package which I execute from VB.NET using the ManagedDTS namespace objects. I am getting a very sporadic error saying "The script threw an exception. Object reference not set to an instance of an object"

All the package does is insert rows from a filename that I pass into the package from code, and then rename the file in a script task. The script task is what is causing this error. If I remove/disable the script task the package executes everytime without error. I have even commented out all the code that might throw an exception and it still fails atleast 3 out of 10 times. Here is my code in the script task:


Public Sub Main()

'

' Add your code here

'

Dim e As String = ""

Dim strFileName As String = ""

Dim strDestination As String = ""

Try

'strFileName = Dts.Variables("User::FileName").Value.ToString()

'strDestination = System.IO.Path.ChangeExtension(strFileName, "processed")

'If File.Exists(strFileName) Then

'System.IO.File.Move(strFileName, strDestination)

Dts.TaskResult = Dts.Results.Success

'End If

Catch ex As Exception

e = ex.Message

Dts.TaskResult = Dts.Results.Failure

End Try

'CreateControlFile(strFileName, strDestination, e)
End Sub


NOTE: I never get a package FAILURE as I would if it got into the CATCH block. I believe this is an error being generated from the Package processing engine.

Here is some output from the VB.NET application debug window:

This output's once for every "exception" thrown by each package execution.


A first chance exception of type 'System.NullReferenceException' occurred in VBAssembly

A first chance exception of type 'System.NullReferenceException' occurred in VBAssembly

A first chance exception of type 'System.IO.IOException' occurred in mscorlib.dll



Here is the code I use to execute the package:



Public Function ConsumePackage(ByVal strPath As String, ByVal strPackage As String) As Boolean

Dim bReturn As Boolean = False

Dim pkg As New Package

Dim app As New Application

Dim result As DTSExecResult = DTSExecResult.Failure

Try

pkg = app.LoadPackage(strPackage, Nothing)

Debug.Print("Executing package on file: " + strPath)

pkg.Variables("FileName").Value = strPath



result = pkg.Execute()

If result = DTSExecResult.Failure Or result = DTSExecResult.Canceled Then

For Each d As DtsError In pkg.Errors

ErrorMessage += d.ErrorCode.ToString() + d.Description.ToString() + vbCrLf

Next

Return False

End If

bReturn = True

Catch ex As Exception

bReturn = False

Finally

pkg.Dispose()

pkg = Nothing

app = Nothing

End Try



End Function

View 4 Replies View Related

Java.sql.DriverManager.getConnection Threw An Exception

Apr 11, 2007

i download JDBC (JDBC service Pack 1) on Solaris, to connect to Microsoft sql 2000 (Developer Edition, Service Pack 2).

i used the code like that:
Connect=DSN=jdbc:microsoft : sqlserver://x.x.x.x:1433;UID=sa;PWD=*******

but the program show this error:
java.sql.DriverManager.getConnection threw an exception

PLZ can any one help me.

View 3 Replies View Related

System.UnauthorizedAccessException: Access Is Denied. (Exception From HRESULT: 0x80070005 (E_ACCESSDENIED))

Oct 17, 2005

I am trying to access a SQL 2005 database on a seperate machine, using a COM+ proxy which is installed on my machine. I keep getting this error:

View 5 Replies View Related

The Script Threw An Exception : Keyword Not Supported: 'network Port'.

May 29, 2008

Hi All,

I need to refresh my cube daily and once this processed is done, i will update in ETL table with lastcubeprocessedtime in my timestamp column. Actually i am using IBM db2 provider since my ETL table resides in IBM DB2 source.

In my first task i am using script task where i will check whether my timestamp column value is NULL or not.

I am getting error like "The script threw an exception : keyword not supported: 'network port'." when this script task executes.

Moreover i am getting another error like "The execution succeeded, but the number of error raised(1) reached the maximum allowed(1); resulting in failure. This occurs when the number of errors reaches the number of specified in MaximumErrorCount. Change the MaximumErrorCount or fix this errors." For this error i have changed MaximumErrorCount value from 1 to 100 in dataflow task.

Can anyone tell me what might be the problem for these two errors?

Thanks in advance
Anand Rajagopal

View 7 Replies View Related

Exception Details: System.Data.SqlClient.SqlException: Procedure 'spInsertBillingQ' Expects Parameter '@bankname', Which Was Not Supplied.

Mar 1, 2007

Hello Coders,
 I need help fixing a problem in my code that I do not understand. I basically have a procedure that is supposed to take all user information and then insert it to the DB or update the Database based on user entry.
The call to the method is this
Dim bankname As String = ""
If (objBill.BillTransaction(Session("conString"), Session("whattobill"), PROC_CURR, Session("lISN"), 0, Session("fISN"), Request.ServerVariables("REMOTE_ADDR"), "scott@mycleanstart.com", Session("fAmount"), Session("first_name"), Session("last_name"), Session("city"), Session("state"), Session("phone"), Session("address1"), Session("address2"), Session("postal_code"), Session("email_address"), Session("fDesc"), Session("ssn"), Session("nameoncard"), Session("PAN"), Session("cvv"), Session("cardexpirationdate"), bankname, Session("txtroutingnumber"), Session("txtaccountnumber"), Session("txtchecknumber"), Session("bqISN"), _
returnedbqISN, AuthCode, OrderNumber, DeclineCode, TermCode, ErrorMessage, authenticationValue, authenticationTransactionID, str_Centinal_ECI, "signup", PAResStatus, SignatureVerification, paypalSubAgreeID, notificationLocation, strErrorNo, strErrorDesc, strTransactionID, strStatus, strStatusCode, strReasonCode)) Then
 
 And then below is the actual method itself........
NOTE: The code below is contained in a DLL
 
 
 
 
 1 public bool BillTransaction(string strDBInstance, string ccORach, string whichProcessor,Int32 lISN, Int32 mISN,
2 Int32 fISN, string ip,string merchant_email,string total_amount,
3 string firstname, string lastname, string city,string state, string phone, string address1,string address2, string zip, string customer_email,
4 string product_desc, string socialsecuritynum, string nameoncard, string creditcardnumber, Int32 cardverifynum, DateTime cardexpiredate,
5 string bankname, string routingnumber, string accountnumber, string checknumber, Int32 bqISN,
6 ref Int32 returnedbqISN, ref string AuthCode, ref string OrderNumber, ref string DeclineCode,
7 ref string TermCode, ref string ErrorMessage,
8 string authenticationValue,string authenticationTransactionID,string eci,string transactiontype,
9 string PAResStatus, string SignatureVerification, string paypalSubAgreeID, string notificationLocation,
10 ref string strErrorNo, ref string strErrorDesc, ref string strTransactionId, ref string strStatus,
11 ref string strStatusCode, ref string strReasonCode)
12
13 {
14
15 if (ccORach.Trim().Length <= 0)
16 {
17 ErrorMessage = "CC or Check?";
18 return false;
19 }
20
21 if (whichProcessor.Trim().Length <= 0)
22 {
23 ErrorMessage = "Blank processor";
24 return false;
25 }
26
27 decimal grand_total = Convert.ToDecimal(decimal.Parse(total_amount).ToString("N2"));
28 string ProcessorResponse="";
29 Database db = DatabaseFactory.CreateDatabase(strDBInstance);
30 DBCommandWrapper dbCmdWrapper = null;
31 bool retBilling = true;
32 string sql = "";
33 string bqAction = "SBILL";
34 string strFirstName = "";
35 string strLastName = "";
36 string[] cardname = nameoncard.Split(new char[] {' '});
37 strFirstName = cardname[0];
38 for (int i=1; i <= cardname.GetUpperBound(0); i++)
39 {
40 strLastName = strLastName + ' ' + cardname[i].Trim();
41 }
42
43 MCS_Encryption.Encryption mcscrypt = new MCS_Encryption.Encryption();
44 //card number
45 string enc_cardnumber = mcscrypt.Encrypt(creditcardnumber);
46 //account number
47 string enc_accountnumber = mcscrypt.Encrypt(accountnumber);
48
49 if (bqISN > 0)
50 {
51 //if bqISN is present, do UPDATE instead
52 sql = "spUpdateBillingQ";
53 dbCmdWrapper = db.GetStoredProcCommandWrapper(sql);
54 dbCmdWrapper.AddInParameter("@bqISN",DbType.Int32,bqISN);
55 dbCmdWrapper.AddInParameter("@email",DbType.String,customer_email);
56 dbCmdWrapper.AddInParameter("@bankname",DbType.String,bankname);
57 dbCmdWrapper.AddInParameter("@routingnumber",DbType.String,routingnumber);
58 dbCmdWrapper.AddInParameter("@accountnumber",DbType.String,enc_accountnumber);
59 dbCmdWrapper.AddInParameter("@checknumber",DbType.String,checknumber);
60 dbCmdWrapper.AddInParameter("@nameoncard",DbType.String,nameoncard);
61 dbCmdWrapper.AddInParameter("@cardnumber",DbType.String,enc_cardnumber);
62 dbCmdWrapper.AddInParameter("@cardverifynum",DbType.Int32,cardverifynum);
63 dbCmdWrapper.AddInParameter("@cardexpirationdate",DbType.DateTime,cardexpiredate);
64 dbCmdWrapper.AddInParameter("@billaddress1",DbType.String,address1);
65 dbCmdWrapper.AddInParameter("@billaddress2",DbType.String,address2);
66 dbCmdWrapper.AddInParameter("@billcity",DbType.String,city);
67 dbCmdWrapper.AddInParameter("@billstate",DbType.String,state);
68 dbCmdWrapper.AddInParameter("@billzip",DbType.String,zip);
69 dbCmdWrapper.AddInParameter("@billphone",DbType.String, phone);
70 dbCmdWrapper.AddInParameter("@ip",DbType.String, ip);
71 dbCmdWrapper.AddInParameter("@fISN",DbType.Int32, fISN);
72 dbCmdWrapper.AddInParameter("@price",DbType.Currency, grand_total);
73 dbCmdWrapper.AddInParameter("@description",DbType.String, product_desc);
74 dbCmdWrapper.AddInParameter("@bqaction",DbType.String, bqAction);
75 dbCmdWrapper.AddInParameter("@creditamount",DbType.Currency, 0);
76 dbCmdWrapper.AddInParameter("@processor",DbType.String, whichProcessor);
77 db.ExecuteNonQuery(dbCmdWrapper) ;
78
79 returnedbqISN = bqISN;
80 }
81 else
82 {
83 //insert into billingQ or update if bqISN is passed
84 sql = "spInsertBillingQ";
85 dbCmdWrapper = db.GetStoredProcCommandWrapper(sql);
86 dbCmdWrapper.AddInParameter("@lISN",DbType.Int32,lISN);
87 dbCmdWrapper.AddInParameter("@mISN",DbType.Int32,mISN);
88 dbCmdWrapper.AddInParameter("@email",DbType.String,customer_email);
89 dbCmdWrapper.AddInParameter("@bankname",DbType.String,bankname);
90 dbCmdWrapper.AddInParameter("@routingnumber",DbType.String,routingnumber);
91 dbCmdWrapper.AddInParameter("@accountnumber",DbType.String,enc_accountnumber);
92 dbCmdWrapper.AddInParameter("@checknumber",DbType.String,checknumber);
93 dbCmdWrapper.AddInParameter("@nameoncard",DbType.String,nameoncard);
94 dbCmdWrapper.AddInParameter("@cardnumber",DbType.String,enc_cardnumber);
95 dbCmdWrapper.AddInParameter("@cardverifynum",DbType.Int32,cardverifynum);
96 dbCmdWrapper.AddInParameter("@cardexpirationdate",DbType.DateTime,cardexpiredate);
97 dbCmdWrapper.AddInParameter("@billaddress1",DbType.String,address1);
98 dbCmdWrapper.AddInParameter("@billaddress2",DbType.String,address2);
99 dbCmdWrapper.AddInParameter("@billcity",DbType.String,city);
100 dbCmdWrapper.AddInParameter("@billstate",DbType.String,state);
101 dbCmdWrapper.AddInParameter("@billzip",DbType.String,zip);
102 dbCmdWrapper.AddInParameter("@billphone",DbType.String, phone);
103 dbCmdWrapper.AddInParameter("@ip",DbType.String, ip);
104 dbCmdWrapper.AddInParameter("@fISN",DbType.Int32, fISN);
105 dbCmdWrapper.AddInParameter("@price",DbType.Currency, grand_total);
106 dbCmdWrapper.AddInParameter("@description",DbType.String, product_desc);
107 dbCmdWrapper.AddInParameter("@bqaction",DbType.String, bqAction);
108 dbCmdWrapper.AddInParameter("@creditamount",DbType.Currency, 0);
109 dbCmdWrapper.AddInParameter("@processor",DbType.String, whichProcessor);
110 returnedbqISN = 0;
111 returnedbqISN = (Int32)db.ExecuteScalar(dbCmdWrapper) ;
112
113 }
114
115
116
117 //bill credit card or ACH
118 switch (ccORach.Trim())
119 {
120 case "CC":
121 retBilling = BillCreditCard(whichProcessor,ip,merchant_email,grand_total, strFirstName.Trim(), strLastName.Trim(),
122 city,state, phone, address1,address2, zip, customer_email,
123 product_desc, socialsecuritynum,creditcardnumber, cardverifynum, cardexpiredate,returnedbqISN,
124 ref AuthCode, ref OrderNumber, ref DeclineCode, ref TermCode, ref ErrorMessage, ref ProcessorResponse,
125 authenticationValue,authenticationTransactionID, eci, transactiontype, PAResStatus, SignatureVerification);
126 break;
127 case "ACH":
128 retBilling = BillACH(whichProcessor, ip,merchant_email, grand_total, firstname, lastname,
129 city,state, phone, address1,address2, zip, customer_email,
130 product_desc, socialsecuritynum,bankname, routingnumber, accountnumber, checknumber, returnedbqISN,
131 ref AuthCode, ref OrderNumber, ref DeclineCode, ref TermCode, ref ErrorMessage, ref ProcessorResponse);
132 break;
133 case "PAYPAL":
134 retBilling = BillPayPal(ip,merchant_email,grand_total,firstname,lastname,
135 city,state,phone,address1,address2,zip,customer_email,
136 product_desc,socialsecuritynum,returnedbqISN, paypalSubAgreeID, notificationLocation,
137 ref strErrorNo, ref strErrorDesc, ref strTransactionId, ref strStatus,
138 ref strStatusCode, ref strReasonCode);
139 break;
140 }
141
142 //insert into billingDetail
143 char bqRecurring = 'N';
144 sql = "spInsertBillingDetail2";
145 dbCmdWrapper = db.GetStoredProcCommandWrapper(sql);
146
147 dbCmdWrapper.AddInParameter("@mISN",DbType.Int32,mISN);
148 dbCmdWrapper.AddInParameter("@bqISN",DbType.Int32,returnedbqISN);
149 dbCmdWrapper.AddInParameter("@bdamountcollected",DbType.Currency,grand_total);
150 dbCmdWrapper.AddInParameter("@bdtransactioncode",DbType.String,AuthCode);
151 dbCmdWrapper.AddInParameter("@bdstatus",DbType.Boolean,retBilling);
152 dbCmdWrapper.AddInParameter("@bdauthcode",DbType.String,AuthCode);
153 dbCmdWrapper.AddInParameter("@bdordernumber",DbType.String,OrderNumber);
154 dbCmdWrapper.AddInParameter("@bdtracecode",DbType.String,returnedbqISN);
155 dbCmdWrapper.AddInParameter("@email",DbType.String,customer_email);
156 dbCmdWrapper.AddInParameter("@bankname",DbType.String,bankname);
157 dbCmdWrapper.AddInParameter("@routingnumber",DbType.String,routingnumber);
158 dbCmdWrapper.AddInParameter("@accountnumber",DbType.String,enc_accountnumber);
159 dbCmdWrapper.AddInParameter("@checknumber",DbType.String,checknumber);
160 dbCmdWrapper.AddInParameter("@nameoncard",DbType.String,nameoncard);
161 dbCmdWrapper.AddInParameter("@cardnumber",DbType.String,enc_cardnumber);
162 dbCmdWrapper.AddInParameter("@cardverifynum",DbType.Int32,cardverifynum);
163 dbCmdWrapper.AddInParameter("@cardexpirationdate",DbType.DateTime,cardexpiredate);
164 dbCmdWrapper.AddInParameter("@billaddress1",DbType.String,address1);
165 dbCmdWrapper.AddInParameter("@billaddress2",DbType.String,address2);
166 dbCmdWrapper.AddInParameter("@billcity",DbType.String,city);
167 dbCmdWrapper.AddInParameter("@billstate",DbType.String,state);
168 dbCmdWrapper.AddInParameter("@billzip",DbType.String,zip);
169 dbCmdWrapper.AddInParameter("@billphone",DbType.String, phone);
170 dbCmdWrapper.AddInParameter("@ip",DbType.String, ip);
171 dbCmdWrapper.AddInParameter("@bqrecurring",DbType.String, bqRecurring);
172 dbCmdWrapper.AddInParameter("@Message",DbType.String, ErrorMessage);
173 dbCmdWrapper.AddInParameter("@ProcessorResponse",DbType.String, ProcessorResponse);
174 dbCmdWrapper.AddInParameter("@processor",DbType.String, whichProcessor);
175
176 dbCmdWrapper.AddInParameter("@strErrorNo",DbType.String, strErrorNo);
177 dbCmdWrapper.AddInParameter("@strErrorDesc",DbType.String, strErrorDesc);
178 dbCmdWrapper.AddInParameter("@strTransactionId",DbType.String, strTransactionId);
179 dbCmdWrapper.AddInParameter("@strStatus",DbType.String, strStatus);
180 dbCmdWrapper.AddInParameter("@strStatusCode",DbType.String, strStatusCode);
181 dbCmdWrapper.AddInParameter("@strReasonCode",DbType.String, strReasonCode);
182
183
184 Int32 returnedbdISN = 0;
185 returnedbdISN = (Int32)db.ExecuteScalar(dbCmdWrapper) ;
186 if (retBilling)
187 {
188 if (UpdateBillingQStatuses(strDBInstance,returnedbqISN,'S'))
189 {
190 return true;
191 }
192 }
193 else
194 {
195 if (UpdateBillingQStatuses(strDBInstance,returnedbqISN,'F'))
196 {
197 return false;
198 }
199 }
200 return false;
201
202 }

 
 
 

View 2 Replies View Related

An Unhandled Exception Occurred During The System.Data.SqlClient.SqlException: Login Failed For User 'IT-CELLIWAM_IT-SERVER'.

Sep 30, 2004

While making a connection to a SQL server Enterprise Database using ASP.Net(C#), during execution of .aspx file i got the following error :-

Kindly help me if anybody knows the solution .

Thanks in advance


Login failed for user 'IT-CELLIWAM_IT-SERVER'.
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.Data.SqlClient.SqlException: Login failed for user 'IT-CELLIWAM_IT-SERVER'.

Source Error:


Line 52: //mycommand.SelectCommand.CommandType=CommandType.StoredProcedure;
Line 53: DataSet ds=new DataSet();
Line 54: mycommand.Fill(ds);
Line 55: DataTable dt;
Line 56: dt=new DataTable();


Source File: c:inetpubwwwrootetapplogin.aspx.cs Line: 54

Stack Trace:


[SqlException: Login failed for user 'IT-CELLIWAM_IT-SERVER'.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +484
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
System.Data.SqlClient.SqlConnection.Open() +384
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
netapp.login.Page_Load(Object sender, EventArgs e) in c:inetpubwwwrootetapplogin.aspx.cs:54
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

View 2 Replies View Related

Error: The Script Threw An Exception: Object Reference Not Set To An Instance Of An Object.

Sep 12, 2006



Anyone know what this error means and how to get rid of it?



Public Sub Main()

Dim myMessage As Net.Mail.MailMessage

Dim mySmtpClient As Net.Mail.SmtpClient

myMessage.To(20) = New Net.Mail.MailAddress(me@hotmail.com)

myMessage.From = New Net.Mail.MailAddress(someone@microsoft.com)

myMessage.Subject = "as;dlfjsdf"

myMessage.Priority = Net.Mail.MailPriority.High

mySmtpClient = New Net.Mail.SmtpClient("microsoft.com")

mySmtpClient.Send(myMessage)

Dts.TaskResult = Dts.Results.Success

End Sub



Thanks,

View 4 Replies View Related

Manage Exception Message

May 26, 2006

How to manage sql server runtime message to users understand it?

In my web form I added folowed code

If Session("Action") = "Edit" Then

Try

ObjectDataSource1.Update()

Catch ex As Exception

lblMessage.Text = ex.GetBaseException.Message

End Try

for manage user input for update the record.

This is message returned by sql server 2005

The UPDATE statement conflicted with the REFERENCE constraint "FK_DEVIZE_RELATION__DRZAVE". The conflict occurred in database "Trgo2006", table "dbo.Devize", column 'Drzava'. The statement has been terminated

This message not understand for users. How to manage messages retrned by sql server, or prepare exception to return message understanded for users.

View 1 Replies View Related

Help With Exception Message (index Too Small)

Feb 4, 2008

Hi,

I found this error while reviewing my logs. I'm not very good with indexes, and the indexes I am using have been generated from the sql wizard. I'm not getting this error on everyquery, just randomly. Is this cause for concern? Why would some queries fail but others not?

Thanks for any assistance!

much appreciated,
mike123


Exception information:
Exception type: SqlException
Exception message: Operation failed. The index entry of length 996 bytes for the index 'tblInstantMessage25' exceeds the maximum length of 900 bytes.

View 3 Replies View Related

No Exception Message From CLR Stored Procedure

Aug 11, 2006

Hello everybody,



I've encountered a strange thing using a CLR Stored procedure:

The procedure throws an exception with no message inside... value = {" "}

Basically the procedure has a string as argument which contains a SQL statement that changes according to the users selections...

The results of the query are saved into a dataset for further processing.

Those resultsets can sometimes be very big (ex: 15000 records...). (For the record the procedure works fine for smaller datasets ex 6000 records and running the same query on the application server returns the expected resultset )

By Debugging the procedure I could determine that the failing point was when the dataset is filled...

Anyone having any idea??

The only information I have from this exception is the stacktrace:



at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

at System.Data.SqlClient.SqlDataReader.CloseInternal(Boolean closeReader)

at System.Data.SqlClient.SqlDataReader.Close()

at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)

at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)

at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)

at System.Data.SqlClient.SqlCommand.ExecuteScalar()

at DataAccess.runScalar(String strSQL, Boolean isStoredProcedure) in c:InetpubwwwrootStatistixApp_CodeDataAccess.cs:line 114

Thanks in advance

Alaindlk

View 5 Replies View Related

Sql Type Exception

Apr 17, 2008



Hi,

I get an error while trying to insert a date to SQL-server. The user input is in the format 2008-04-17. I do however get an error reading something like "Sql Type Exception, date must be formatted between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. Is there an easy way to fix this problem?

Thanks in advance!

View 3 Replies View Related

SqlDataSource.Select Error: Unable To Cast Object Of Type 'System.Data.DataView' To Type 'System.String'.

Oct 19, 2006

I am trying to put the data from a field in my database into a row in a table using the SQLDataSource.Select statement. I am using the following code: FileBase.SelectCommand = "SELECT Username FROM Files WHERE Filename = '" & myFileInfo.FullName & "'" myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments()), String)But when I run the code, I get the following error:Server Error in '/YorZap' Application. Unable to cast object of type 'System.Data.DataView' to type 'System.String'. 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.InvalidCastException: Unable to cast object of type 'System.Data.DataView' to type 'System.String'.Source Error: Line 54: FileBase.SelectCommand = "SELECT Username FROM Files WHERE Filename = '" & myFileInfo.FullName & "'"
Line 55: 'myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments).GetEnumerator.Current, String)
Line 56: myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments()), String)
Line 57:
Line 58: filesTable.Rows.Add(myDataRow)Source File: D:YorZapdir_list_sort.aspx    Line: 56 Stack Trace: [InvalidCastException: Unable to cast object of type 'System.Data.DataView' to type 'System.String'.]
ASP.dir_list_sort_aspx.BindFileDataToGrid(String strSortField) in D:YorZapdir_list_sort.aspx:56
ASP.dir_list_sort_aspx.Page_Load(Object sender, EventArgs e) in D:YorZapdir_list_sort.aspx:7
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45
System.Web.UI.Control.OnLoad(EventArgs e) +80
System.Web.UI.Control.LoadRecursive() +49
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3743
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210 Please help me!

View 3 Replies View Related

Unable To Cast COM Object Of Type 'System.__ComObject' To Class Type 'System.Data.SqlClient.SqlConn

May 17, 2006

Dear all,

I am stuck with a SSIS package and I can€™t work out. Let me know what steps are the correct in order to solve this.
At first I have just a Flat File Source and then Script Component, nothing else.

Error:





[Script Component [516]] Error: System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type 'System.Data.SqlClient.SqlConnection'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface. at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.AcquireConnections(Object transaction) at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostAcquireConnections(IDTSManagedComponentWrapper90 wrapper, Object transaction)



Script Code (from Script Component):



' Microsoft SQL Server Integration Services user script component
' This is your new script component in Microsoft Visual Basic .NET
' ScriptMain is the entrypoint class for script components

Imports System
Imports System.Data.SqlClient
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper


Public Class ScriptMain
Inherits UserComponent


Dim nDTS As IDTSConnectionManager90
Dim sqlConnecta As SqlConnection
Dim sqlComm As SqlCommand
Dim sqlParam As SqlParameter


Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)

Dim valorColumna As String
Dim valorColumna10 As Double


valorColumna = Row.Column9.Substring(1, 1)

If valorColumna = "N" Then
valorColumna10 = -1 * CDbl(Row.Column10 / 100)
Else
valorColumna10 = CDbl(Row.Column10 / 100)
End If

Me.Output0Buffer.PORCRETEN = CDbl(Row.Column11 / 100)
Me.Output0Buffer.IMPRETEN = CDbl(Row.Column12 / 100)
Me.Output0Buffer.EJERCICIO = CInt(Row.Column2)
Me.Output0Buffer.CODPROV = CInt(Row.Column7)
Me.Output0Buffer.MODALIDAD = CInt(Row.Column8)
Me.Output0Buffer.NIFPERC = CStr(Row.Column3)
Me.Output0Buffer.NIFREP = CStr(Row.Column4)
Me.Output0Buffer.NOMBRE = CStr(Row.Column6)
Me.Output0Buffer.EJERDEV = CDbl(Row.Column13)

With sqlComm
.Parameters("@Ejercicio").Value = CInt(Row.Column2)
.Parameters("@NIFPerc").Value = CStr(Row.Column3)
.Parameters("@NIFReP").Value = CStr(Row.Column4)
.Parameters("@Nombre").Value = CStr(Row.Column6)
.Parameters("@CodProv").Value = CInt(Row.Column7)
.Parameters("@Modalidad").Value = CInt(Row.Column8)
.Parameters("@ImpBase").Value = valorColumna10
.Parameters("@PorcReten").Value = CDbl(Row.Column11 / 100)
.Parameters("@ImpReten").Value = CDbl(Row.Column12 / 100)
.Parameters("@EjerDev").Value = CDbl(Row.Column13)

.ExecuteNonQuery()
End With


End Sub
Public Overrides Sub AcquireConnections(ByVal Transaction As Object)

Dim nDTS As IDTSConnectionManager90 = Me.Connections.TablaMODELO80
sqlConnecta = CType(nDTS.AcquireConnection(Nothing), SqlConnection)

End Sub
Public Overrides Sub PreExecute()

sqlComm = New SqlCommand("INSERT INTO hac_modelo180(Ejercicio,NIFPerc,NIFReP,Nombre,CodProv,Modalidad,ImpBase,PorcReten,ImpReten,EjerDev) " & _
"VALUES(@Ejercicio,@NIFPerc,@NIFReP,@Nombre,@CodProv,@Modalidad,@ImpBase,@PorcReten,@ImpReten,@EjerDev)", sqlConnecta)
sqlParam = New SqlParameter("@Ejercicio", Data.SqlDbType.SmallInt)
sqlComm.parameters.add(sqlParam)
sqlParam = New SqlParameter("@NIFPerc", Data.SqlDbType.Char)
sqlComm.parameters.add(sqlParam)
sqlParam = New SqlParameter("@NIFReP", Data.SqlDbType.Char)
sqlComm.parameters.add(sqlParam)
sqlParam = New SqlParameter("@Nombre", Data.SqlDbType.VarChar)
sqlComm.parameters.add(sqlParam)
sqlParam = New SqlParameter("@CodProv", Data.SqlDbType.TinyInt)
sqlComm.parameters.add(sqlParam)
sqlParam = New SqlParameter("@Modalidad", Data.SqlDbType.SmallInt)
sqlComm.parameters.add(sqlParam)
sqlParam = New SqlParameter("@ImpBase", Data.SqlDbType.Decimal)
sqlComm.parameters.add(sqlParam)
sqlParam = New SqlParameter("@PorcReten", Data.SqlDbType.Decimal)
sqlComm.parameters.add(sqlParam)
sqlParam = New SqlParameter("@ImpReten", Data.SqlDbType.Decimal)
sqlComm.parameters.add(sqlParam)
sqlParam = New SqlParameter("@EjerDev", Data.SqlDbType.Decimal)
sqlComm.Parameters.Add(sqlParam)

End Sub


Public Sub New()

End Sub
Public Overrides Sub ReleaseConnections()
nDts.ReleaseConnection(sqlConnecta)
End Sub

Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub
End Class







Thanks a lot for your help


View 13 Replies View Related

@PARAM1 : Unable To Cast Object Of Type 'System.Data.SqlTypes.SqlInt32 To Type System.IConvertable

Apr 23, 2007

I get the following message in the vs2005 querybuilder when i do a preview:



***********************************
SQL Execution Error.

Executed SQL statement: SELECT Schoolindex, Variant, VVSchool, [index], indincl, VVRuimtes, School FROM School WHERE (Schoolindex = @PARAM1)



Error Source: SQL Server Compact Edition ADO.NET Data Provider


Error Message: @PARAM1 : Unable to cast object of type 'System.Data.SqlTypes.SqlInt32 to type System.IConvertable'.
****************************************

The same querypreview works fine without the parameter:



SELECT Schoolindex, Variant, VVSchool, [index], indincl, VVRuimtes, School FROM School WHERE (Schoolindex = 186)



Can anybody tell me why this is?
And tell me a way to get the tableadapter working?



Anne-Jan Tuinstra

View 3 Replies View Related

Unable To Cast Object Of Type 'System.String' To Type 'System.Web.UI.WebControls.Parameter'.

Jun 19, 2008

I'm getting this error on a vb.net page the needs to execute two separate stored procedures.  The first one, is the main insert, and returns the identity value for the ClientID.  The second stored procedure inserts data, but needs to insert the ClientID returned in the first stored procedure.  What am I doing wrong with including the identity value "ClientID" in the second stored procedure? 
Unable to cast object of type 'System.String' to type 'System.Web.UI.WebControls.Parameter'. 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.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Web.UI.WebControls.Parameter'.Source Error:




Line 14: If li.Selected Then
Line 15: InsertClientCompanyType.InsertParameters("CompanyTypeID").DefaultValue = li.Value
Line 16: InsertClientCompanyType.InsertParameters("ClientID") = ViewState("ClientID")
Line 17:
Line 18:
Source File: C:InetpubwwwrootIntranetExternalAppsNewEmploymentClientNewClient.aspx.vb    Line: 16
Here is my code behind... What am I doing wrong with grabbing the ClientID from the first stored procedure insert? 
 
Protected Sub InsertNewClient_Inserted(ByVal sender As Object, ByVal e As SqlDataSourceStatusEventArgs)ClientID.Text = e.Command.Parameters("@ClientID").Value.ToString()ViewState("ClientID") = e.Command.Parameters("@ClientID").Value.ToString()End SubProtected Sub Submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit.ClickInsertNewClient.Insert()For Each li As ListItem In CompanyTypeID.Items
If li.Selected ThenInsertClientCompanyType.InsertParameters("CompanyTypeID").DefaultValue = li.ValueInsertClientCompanyType.InsertParameters("ClientID") = ViewState("ClientID")InsertClientCompanyType.Insert()End IfNextEnd Sub

View 2 Replies View Related

System.Security.SecurityException: Request For The Permission Of Type 'System.Data.SqlClient.SqlClientPermission, System.Data

Aug 21, 2006

I have created a windows library control that accesses a local sql database

I tried the following strings for connecting

Dim connectionString As String = "Data Source=localhostSQLEXPRESS;Initial Catalog=TimeSheet;Trusted_Connection = true"

Dim connectionString As String = "Data Source=localhostSQLEXPRESS;Initial Catalog=TimeSheet;Integrated Security=SSPI"



I am not running the webpage in a virtual directory but in

C:Inetpubwwwrootusercontrol

and I have a simple index.html that tries to read from an sql db but throws

the error

System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.PermissionSet.Demand()
at System.Data.Common.DbConnectionOptions.DemandPermission()
at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection,

etc etc

The action that failed was:
Demand
The type of the first permission that failed was:
System.Data.SqlClient.SqlClientPermission
The Zone of the assembly that failed was:
Trusted


I looked into the .net config utility but it says unrestricted and I tried adding it to the trusted internet zones in ie options security

I think that a windows form connecting to a sql database running in a webpage should be simple

to configure what am I missing?

View 28 Replies View Related

Unable To Cast Object Of Type 'System.DBNull' To Type 'System.Byte[]'.

Aug 13, 2007

Hi,
I have developed a custom server control for .NET Framework 2.0. The server control has a property named BinaryData of type byte[]. I marked this property to be data bindable. Now, I have varbinary(Max) type of field in my SQL Database and I have used SQLDataSource and bound this varbinary(Max) field with the property BinaryData (byte[]) of my control. It is working fine as long as the data value is not NULL. Now, In my control, I have handled the NULL value so that no Exception is thrown. Still, when I bind this property using the SQLDataSource, I get Error "Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'." I am not sure if I can do anything to stop this erro within my control. If it is not possible from the control, then what is the workaround that I can do in my ASPX page in order to stop this error ?
Thanks a lot in advance.

View 10 Replies View Related

Unable To Cast Object Of Type 'System.DateTime' To Type 'System.String'.

Dec 31, 2007

 Hi,      I got this field (dateSubmitted) having a data type of DateTime but I receive this error "Unable to cast object of type 'System.DateTime' to type 'System.String'."       All value for dateSubmitted field are 12/27/2007 12:00:00 AM. cheers,imperialx 

View 3 Replies View Related

Sql Exception

Jun 29, 2006

Guys, I need your help on this one. I have a problem here. There is an exception on my conn.Open.
It said that "SQL Exception was unhandled by user code. Cannot open database requested in login 'MUSIC STORE'. Login fails.Login failed for user 'IT785P13student'."
Does anyone have any idea what this means?
 
 

View 2 Replies View Related

Sql Exception

Nov 19, 2006

I downloaded a web site from internet and tried to open it in visual web developer express edition but it gave an error and the code and the error was:
      CODE- Return CType(Me.GetPropertyValue("Theme"),String)
     ERROR -An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.
 An answer will be very good for me

View 1 Replies View Related

Sql Exception

May 25, 2007

 Hi -  I am new to *** forum and could really use some help. I am trying to insert the following values in an sql server 2003 database and I get an exception labeled:System.Data.SqlClient.SqlException: Incorrect syntax near ')'. Source:Line 91: connection.Open();Line 92: int numRowsAffected;Line 93: numRowsAffected= command.ExecuteNonQuery();Line 94: connection.Close();Line 95: Stack Trace:[SqlException (0x80131904): Incorrect syntax near ')'.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +95 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +82 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +3244 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +186 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1121 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +334 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +407 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +149 _Default.Button1_Click(Object sender, EventArgs e) in e:Hampton DirectWebsitesLunchOrderRestaurantEditor.aspx.cs:93 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +96 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +116 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72 Source Code: SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["LunchOrderTestDBConnectionString1"].ToString());SqlCommand command = new SqlCommand("INSERT INTO Restaurants (Name,Address1,Phone,Fax,Menu_Pages,) VALUES ( @Name,@Address1,@Phone,@Fax,@Menu_Pages)", connection); //@MenuSqlParameter param0 = new SqlParameter( "@Name", SqlDbType.VarChar,50 );param0.Value = TextBox1.Text;command.Parameters.Add( param0 );SqlParameter param1 = new SqlParameter("@Address1", SqlDbType.VarChar, 50);param1.Value = TextBox2.Text;command.Parameters.Add(param1);SqlParameter param2 = new SqlParameter("@Phone", SqlDbType.VarChar, 50);param2.Value = TextBox3.Text;command.Parameters.Add( param2 );SqlParameter param3 = new SqlParameter("@Fax", SqlDbType.VarChar, 50);param3.Value = TextBox5.Text;command.Parameters.Add(param3);//SqlParameter param4 = new SqlParameter("@Menu", SqlDbType.Image);//param4.Value = byte_data;//command.Parameters.Add(param4);SqlParameter param5 = new SqlParameter("@Menu_Pages", SqlDbType.Int, 50);param5.Value = Int32.Parse(TextBox6.Text);command.Parameters.Add(param5);connection.Open();int numRowsAffected;numRowsAffected= command.ExecuteNonQuery();connection.Close();Thank You in advance for all help and suggestions!   

View 1 Replies View Related

SQL Exception

Jul 23, 2007

I am trying to insert data into a table and I am getting a SQL Exception: System.Data.SqlClient.SqlException {"Incorrect syntax near 'nvarchar'. Must declare the scalar variable "@"."} 
This is my subroutine that is executed once the submit button is clicked.
Please advise. Thank you for your time!
 1 Protected Sub SubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
2 Dim CMLdataSource As New SqlDataSource()
3 Dim commStr As String
4
5 CMLdataSource.ConnectionString = ConfigurationManager.ConnectionStrings("CMLConnectionString1").ToString()
6
7 CMLdataSource.InsertCommandType = SqlDataSourceCommandType.Text
8 commStr = "INSERT INTO SCOs (ProjCode, SCONum, SCORev, DateIssued, DateAssigned, ProjName, CSCI, Description, [IDENT NUMBER], REV, PPRChgAbstract, SourceCodeChange, DocumentChange, "
9 commStr = commStr & "DocChangeRev, ChangeNoticeNum, TechInvest, CDMRep, TestEngineer, SQE, SCCBChair, CDMLibrarian, ECPNum, [CLASS 1], [CLASS 2]) "
10 commStr = commStr & "VALUES (@ProjCode, @SCONum, @SCORev, @DateIssued, @DateAssigned, @ProjName, @CSCI, @Description, @[IDENT NUMBER], @REV, @PPRChgAbstract, @SourceCodeChange, @DocumentChange, "
11 commStr = commStr & "@DocChangeRev, @ChangeNoticeNum, @TechInvest, @CDMRep, @TestEngineer, @SQE, @SCCBChair, @CDMLibrarian, @ECPNum, @[CLASS 1], @[CLASS 2])"
12
13 CMLdataSource.InsertCommand = commStr
14
15 CMLdataSource.InsertParameters.Add("ProjCode", CodeList.Text)
16 CMLdataSource.InsertParameters.Add("SCONum", scoNum.Text)
17 CMLdataSource.InsertParameters.Add("SCORev", ScoRevTextBox.Text)
18 CMLdataSource.InsertParameters.Add("DateIssued", DateIssuedTextBox.Text)
19 CMLdataSource.InsertParameters.Add("DateAssigned", DateAssigTextBox.Text)
20 CMLdataSource.InsertParameters.Add("ProjName", ProjectList.Text)
21 CMLdataSource.InsertParameters.Add("CSCI", CsciTextBox.Text)
22 CMLdataSource.InsertParameters.Add("Description", MediaTextBox.Text)
23 CMLdataSource.InsertParameters.Add("[IDENT NUMBER]", IDTextBox.Text)
24 CMLdataSource.InsertParameters.Add("REV", RevTextBox.Text)
25 CMLdataSource.InsertParameters.Add("PPRChgAbstract", PPRTextBox.Text)
26 CMLdataSource.InsertParameters.Add("SourceCodeChange", SourceCodeTextBox.Text)
27 CMLdataSource.InsertParameters.Add("DocumentChange", DocTitleTextBox.Text)
28 CMLdataSource.InsertParameters.Add("DocChangeRev", RevLetterTextBox.Text)
29 CMLdataSource.InsertParameters.Add("ChangeNoticeNum", ChangeNoticeTextBox.Text)
30 CMLdataSource.InsertParameters.Add("TechInvest", TechInvestTextBox.Text)
31 CMLdataSource.InsertParameters.Add("CDMRep", SwCdmTextBox.Text)
32 CMLdataSource.InsertParameters.Add("TestEngineer", TestEngTextBox.Text)
33 CMLdataSource.InsertParameters.Add("SQE", SqeTextBox.Text)
34 CMLdataSource.InsertParameters.Add("SCCBChair", SccbChairTextBox.Text)
35 CMLdataSource.InsertParameters.Add("CDMLibrarian", CdmLibTextBox.Text)
36 CMLdataSource.InsertParameters.Add("ECPNum", EcpNumTextBox.Text)
37 CMLdataSource.InsertParameters.Add("[Class 1]", Class1TextBox.Text)
38 CMLdataSource.InsertParameters.Add("[Class 2]", Class2TextBox.Text)
39
40 Dim RowsAffected As Integer = 0
41
42 Try
43 RowsAffected = CMLdataSource.Insert()
44 Catch ex As Exception
45 CMLdataSource = Nothing
46 Server.Transfer("dberror.aspx")
47 Finally
48 CMLdataSource = Nothing
49 End Try
50
51
52 If RowsAffected <> 1 Then
53
54 Server.Transfer("dbError.aspx")
55
56 Else
57 Server.Transfer("newConfirm.aspx")
58
59 End If
60
61
62 End Sub
 

View 16 Replies View Related

SQL Exception??

Aug 30, 2007

Could somebody please tell me what is wrong with this SQL Statement. I'm trying to run it in SQL Server 2000, and keep getting the error:
 System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'GROUP'
but as far as I can see, there isn't anything wrong near "GROUP"..." SELECT b.ColorID, b.ColorName, " +
" MAX(a.ColorID) AS DesignerProductAvailability_ColorID, " +" MAX(a.Quantity) AS DesignerProductAvailability_Quantity, " +
" MAX(a.ProductID) AS DesignerProductAvailability_ProductID " +" FROM DesignerProductAvailability a " +
" INNER JOIN ColorList b " +" ON b.ColorID = DesignerProductAvailability_ColorID " +
" WHERE DesignerProductAvailability_ProductID = @ProductID AND " +" DesignerProductAvailability_Quantity > 0 " +
" ORDER BY b.ColorName ASC " +
" GROUP BY b.ColorName ";
 Any help would be greatly appreciated. Thanks in advance!

View 13 Replies View Related

Exception

Jun 9, 2008

I am passing the values to a class which has a method to insert the date into database. How to retrive this exception thrown in this method and disply to user.

View 10 Replies View Related







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