C# - OleDBException Using Fill Method Of OleDbDataAdapter?

Nov 2, 2010

I'm using a OleDbDataAdapter object to fetch certain data from a database and place it in a data set object. The code for this is presented below:

oleConn = new OleDbConnection(WebConfigurationManager.ConnectionStrings["PTDB-ConnectString"].ConnectionString);
oleConn.Open();
oleComm = new OleDbCommand("spGetPartRevisionFromSN @SerialNumber = " + SN, oleConn);
oleComm.CommandType = CommandType.Text;
ds = new DataSet();
da = new OleDbDataAdapter(oleComm);
da.Fill(ds); //<--OleDbException occurs here

My problem is that when the program reaches the Fill method of the data adapter, I receive an OleDbException with the error being "Incorrect syntax near 'SN' ", where SN is an alphanumeric serial number. I have a few SNs that I'm testing, the pattern I notice is that the method seems to run fine with an SN that begins with a letter, e.g. "J123456", but this exception gets thrown for every SN that begins with a number, e.g. "1ABCDEF". I'm not alterting the SNs, which are just strings, in any way and I've run the SELECT query, defined in the stored procedure, in SQL Server Management Studio with both kinds of SNs without a problem.

View 2 Replies


Similar Messages:

ADO.NET :: Correct Way To Fill A DataTable With A TableAdapter Method?

Dec 1, 2010

I have a dataset with a table adapter that has several queries. I want to execute on of the queries and fill a data table but am having trouble with this operation. Am I invoking my table adapter incorrectly? See line 56.

[Code]....

View 2 Replies

Fill View Page Of This Controller Method?

Apr 23, 2010

Why will not fill View page of this controller method

public ActionResult Person()
{
testEntities6 testPersons = new testEntities6();[code].....

View 1 Replies

Javascript - Fire Method To Fill Detailsview Control From Jquery Autocomplete Input?

Mar 8, 2011

I have an input box for searching employee info (attached to a jquery autocomplete), and a box for employee number. The employee info queries multiple values (Lastname Firstname, Title, Clocknum) and returns them all as a string via the autocomplete. This is only if they dont know the clock number. The additional box is so they can search via clocknum as well.

Is there a way, to fire a method which populates a data control after clicking on or tabbing on the selected jquery autocomplete value?

View 1 Replies

Keep Leading Zeros In A OleDbDataAdapter?

Jan 13, 2011

I have understood there is no way to keep leading zeros in a OleDbDataAdapter?

Im trying to read some data from a text file with:

MyCommand = New System.Data.OleDb.OleDbDataAdapter("SELECT F7, F5, F9, F1 FROM " & System.IO.Path.GetFileName(bonnerfil.PostedFile.FileName), MyConnection)

I have managed to keep leading zeros if I add a Schema.ini file into the directory with column set to Char.

But, when having a Shema.ini the select statement reads from start to end of the file. As you see in my select statement I prefer/must have the coulumn 7 first being read and so on. This do work and I will have get the result I want. But for now itīs either - get the order of columns correct or have leading zeros.

how can I either have a Schema.ini that reads the file in the order I want, or keep leading zeros and not have the order I want.

Code:

[Code]....

View 1 Replies

Access :: C# OleDBDataAdapter And Results That Contain A Dash (-)?

Apr 29, 2010

I am running a query on an Access 2000 database from my C# code. Whenever any part of my results contain a dash (-) then my adapater will not fill and will just show no rows. So what I did was use the Replace function in the Access Query. Of course once I did this then I received an error from ASP, because the Jet engine does not know what to do with Replace.

So my question is how do I get this data to fill my adapater if it sometimes contains a dash, but I can't use the Replace function in the Access query? My current C# code is below.

[Code]....

View 6 Replies

DataSource Controls :: Multi-Threading With OleDbDataAdapter?

Jun 22, 2010

I have a .NET 4.0 console application that does a lot of reads from SQL Server 2008 using the OleDbDataAdapter object.I tried to improve performance by spreading the processing logic across four threads using Visual Studio 2010's Task Parallel Library. Sadly the multi-threaded version is three times slower than the original. Using VS2010's performance tools, I found thousands of thread contentions caused by the method OleDbDataAdapter.Fill() which populates a DataSet.This is puzzling as there are no static classes or variables involved that would result in the OleDbDataAdapter being shared by my threads. Also, four simultaneous connections just can't cause a hold up at the database level, right? The default connection pool size should be much larger than this.

View 1 Replies

Databases :: Play Around With Column's Names Filled By OleDbDataAdapter?

May 3, 2010

I tried to query an excel file which contains a lot of customers' information but my problem is most of those don't have a specific column names. E.g. it's in the following format. (Excel File)

A B C
Info1 blur blur
Info2 blur blur
Info3 blur blur

So, when I query using SqlDbDataAdapter, in my DataTable, info1 blur blur becomes column header. e.g. it's in the following format. (DataTable)

Info1 blur blur
Info2 blur blur
Info3 blur blur

I been working on it so that it actually goes down one row and Change the column name in the DataTable into some appropiate name. Something like the following format.

Name1 Name2 Name 3
Info1 blur blur
Info2 blur blur
Info3 blur blur

Is there any way that I could work around it rather than actually going back to change the excel files ? Because I have like 1,000 excel files in that kinda format and seriously giving me headache now.

View 5 Replies

ADO.NET :: Select Statement In System.Data.OleDb.OleDbDataAdapter

Nov 11, 2010

I have problem with select statement in System.Data.OleDb.OleDbDataAdapter My code is:

Dim adp As New System.Data.OleDb.OleDbDataAdapter("select * from tblMember where
username='"& emailV &"' and PWD='"&PWDv&"' ", con)
Dim dt As New System.Data.DataTable
adp.Fill(dt)

it has problem with username='"& emailV &"' and PWD='"&PWDv&"'

View 2 Replies

Databases :: OleDBException: Too Many Fields Defined?

Aug 25, 2010

I'm trying to import an Excel file into a datatable. It works fine most of the time. However, I get this error when there are more than 255 columns in the Excel file. The columns are empty (after about 6 or so), but since they've been formatted it sees them anyway.My question is, is there any way around this? Can I limit the amount of columns somehow? Unfortunately, I can't just remove the columns in the Excel document, as this is being designed for users to upload documents, so I have to account for this possibility (even though most of the time there will be maximum 20 columns).Here is the code I'm using:

[Code]....

The exception is thrown on the "da.Fill(_transactions)" line.

View 2 Replies

Access :: Getting Error - OleDbException Was Unhelded By User Code

Apr 15, 2010

[Code]....

I am a asp.net learner. I have got seven textbox and a button on the page. I should be able to write text in the textboxes and save them in access database. I can run it OK, but when I write something in the texboxes and try to save it I get the following error.

'OleDbException was unhelded by user code'

also the following,

'Could not find file C:mohammadpweb_devcustomer.mbd'

View 37 Replies

DataSource Controls :: OledbException Was Unhandled By The User Code

May 3, 2010

I'm stuck with this query. I've tried a lot but ended up with no clue. Here is my sql query which is worrying me.. sqlselect = "select qo.OrderDate,qo.RequiredDate,qo.ShippedDate" & _

View 13 Replies

System.Data.OleDb.OleDbException - No Value Given For One Or More Required Parameters

Mar 7, 2010

I have used Visual Studio 2008 ASP.NET AccessDataSource Wizard to generate the update command. The gridview edit button works. But when I click on Update Link in Gridview, I get this message:

System.Data.OleDb.OleDbException: No value given for one or more required parameters.

This is the source code it generated:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">.......

View 2 Replies

Databases :: Get The Sql Statement Query Or Table Name If Oledbexception Occurs?

Jun 21, 2010

how to get the sql statement query or table name if oledbexception occurs - table or view does not exists.

get the DB details from the oledb exception.

View 1 Replies

Access :: System.Data.OleDb.OleDbException Displayed On Uploading To Server

Jul 30, 2010

I have a simple update query to a access database. Works perfectly on my localhost but when I upload it to the server it displays this. The weird thing in the "

monstababy.MailingList.btnSubmit_Click(Object sender, EventArgs e) in C:inetpubwwwrootmonstababymonstababymonstababyMailingList.aspx.cs:26" mention of my

local host settings on the server. I have spoken to my host and they have set permissions for the data folder etc but this still prevails. I am positive it

Source Error:
[Code]....

Stack Trace:
[Code]....

View 3 Replies

Databases :: System.Data.OleDb.OleDbException: Could Not Find Installable ISAM

Aug 26, 2010

i got the following error while i am trying to get my web application to run on windows server 2003. I've installed 2007 data access components on windows server 2003 but the web application does not seem to work. The codes that i use is as follows:

[code]....

I've read a lot of forum posts and almost all of them mentioned ab out the connectionstring being wrong. However, when i ran the codes on my local machine, there were no errors. The error only show when i was running on windows server 2003.

View 9 Replies

DataSource Controls :: Reading Excel Files To Store Into Sqlserver Database - OleDbException Was Unhandled By User Code

Feb 1, 2010

i've got some problem reading excel files to store into sqlserver database. currently my code has a fileupload control and a button for me to save the excel file into a folder and read the data inside the excel file and write it into the sql database. The code works only if the excel sheet name is Sheet1.xlsx, however i tried upload a diff file named ImportUserFile.xlsx and it gave me the exception below. 'ImportUserFile$' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long. i have also tried other file names and it seemed only Sheet1.xlsx works.

[Code]....

View 1 Replies

How To Fill DataSet By Store Procedure And Fill DataGrid From That DataSet

Jul 4, 2010

I am VB.Net Windows Application Developer Now i am going an ASP.Net Application. So, the Problem is that in Windows Application i Code this Project like given Below Actually i am Using SQL Server as DataBase and Store Procedure as Query.Becuase i had tried to control the ASP.Net Data Grid with Loop and i Failed to Control it with this method

Private Sub btn_Ok_Click(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles btn_Ok.Click
Fill_dataset("Sel_MovNames", "Tbl_MovNames", Convert.toint32(cmb_MovID.SelectedValue))
[code]...

View 2 Replies

Error While Adding Dynamic Data To An Existing Web Site - The Method 'Skip' Is Only Supported For Sorted Input In LINQ To Entities. The Method 'OrderBy' Must Be Called Before The Method 'Skip'.

Apr 13, 2010

I am creating an Asp.net web site which will support dynamic data. When I am creating a dynamic web site from Scratch (from template in VS) all is working fine. But when I am trying to add dynamic entity (.edmx) file and running the application I am getting following error

"The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'. "

View 2 Replies

DataSource Controls :: ObjectDataSource - Update Method To Pass Entity To The Method In BLL Class?

Oct 18, 2010

I have an ObjectDataSource that I want to perform updates using a business entity i.e. Type="Object"). Since the values for the entity are within a user control, I have stored a reference to the control in Session and in the updating event, set the new instance to the value of the entity from the user contol property (which also pulls values from the form viaother properties of the control):

Protected Sub MasterDataSource_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles MasterDataSource.Updating
Dim entity As New Login()
Dim accountControl As AccountInfo = TryCast(Session("AccountCtrl"), AccountInfo)
entity = accountControl.Entity
e.InputParameters.Add("entity", entity)
End Sub

And here's the markup for the datasource:

<asp:ObjectDataSource ID="MasterDataSource" runat="server" EnableCaching="true" CacheDuration="10"
SelectMethod="SelectAll" UpdateMethod="Update" TypeName="Data.DAL.LoginDAL">
</asp:ObjectDataSource>

My question is, how can I get the update method to pass this entity to the update method in my BLL class? It seems the Update method requires an ID or reference to the original object to use in determining whether any changes have taken place, but I don't really want to do this. In other words, I just want to use the Update event on my ObjectDataSource to pass my entity to the method ("Update") I set as a property and then let this business method handle the update of the data. Shown below, is the BLL update method I want to call:

Public Overloads Function Update(ByVal entity As Login)
If entity Is Nothing Then
Throw New ArgumentNullException("entity")
End If
MyBase.Update("UpdateLogin", entity.Username, entity.Password, entity.FirstName, entity.LastName, entity.Role, entity.Region, _
entity.Email, entity.Title, entity.TierID, entity.Street, entity.City, entity.State, entity.Zip, entity.Mobile, entity.Phone, entity.Fax)
End Function

When I try to call this as it stands now, I get an error: ObjectDataSource 'MasterDataSource' could not find a non-generic method 'Update' that has parameters: ID, entity. Previously, I'd set up a long list of parameters of basic data types (string, int, boolean), but this is rather cumbersome and I was hoping to use an entity for this (FYI, I also got the same type of error when I tried this approach, but with the ID as the
last parameter in the list). Perhaps what I'm doing here is atypical to how the ODS is normally used?? Has anyone done something like this successfully?

View 1 Replies

AJAX :: Calling Webservices From Javascript: OnError Method, How To Identify The Method

Aug 26, 2010

I have an application that has JS calling ASMX files to do asyncronous requests, using ASP.NET AJAX.

The problem is that I use always the same "onError" function, and now I don't know how to identify the method that rised the error, and it is giving me a lot of problems to debug errors. The parameter "data" of the onError method does not give enough information, for
example:

en System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
en System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)
en System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)
en System.Web.Script.Serialization.ObjectConverter.ConvertObjectToType(Object o, Type type, JavaScriptSerializer serializer)
en System.Web.Script.Services.WebServiceMethodData.StrongTypeParameters(IDictionary`2 rawParams)
en System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters)
en System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)
en System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)

Is there any way to know the webmethod that raised the error?

View 1 Replies

Web Forms :: Onclick Method At Submitbutton Throws Error: Undefined Method

Dec 15, 2010

I don't know what I'm making wrong.I have a submit button, and on click it should execute the funktion in the code behind, but I get the error that the funktion is undefined.this is my code in the .aspx webform:

<%@ Page Language="C#" AutoEventWireup="True" MasterPageFile="~/DashMaster.master" CodeBehind="BI_MDR.aspx.cs" Inherits ="BI_MDR.StoredProc"%> [code].......

View 2 Replies

Web Method That Accepts A List<CustomObject> Is Failing With "Web Service Method Name?

Feb 8, 2010

I want to create a web method that accepts a List of custom objects (passed in via jQuery/JSON). When I run the website locally everything seems to work. jQuery and ASP.NET and everyone is happy. But when I put it on one of our servers it blows up. jQuery gets a 500 error after the ajax request with the response being:

System.InvalidOperationException: EditCustomObjects Web Service method name is not valid.
[WebMethod]
public void EditCustomObjects(int ID, List<CustomObject> CustomObjectList)
[code]...

View 8 Replies

Catch Method And Log File - Which One Is The Best Method To Handle Error In Web Based Project

Nov 9, 2010

I have seen 2 methods to handle error in project. One is using try catch in every method and another is using custom page and error log file .I know both method. Which one is the best method?

View 9 Replies

DetailsView_ModeChanged Method Does Not Find Controls In A Certain Mode Using FindCotrol Method

Dec 4, 2010

I have a DetailsView control about a store products.

When I hit the "Edit" button of the DetailsView control, I want to bind a DropDownList to list products categories and select the current product category in it.

I used the method "ModeChanged" to select the current product category like this:

[Code]....

the FindControl method DOES NOT find the "ddlCategory" (returns null) although it's present in the EditTemplateField.

I'm thinking to use "DropDownList's PreRender" event for doing the purpose I aim, but I want to know what is wrong!

View 1 Replies







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