ado.net

Ticket Booking System: Database access issue

痞子三分冷 提交于 2020-01-11 14:11:24
问题 I'm creating a Bus Ticket booking system. I have created a database called traveller and two tables named Useriden and BusDB respectively. In the aspx.cs file(Sign Up page), I'm checking for duplicate usernames but it simply navigates to the next page I've tried everything but I'm unable to resolve this issue. I'm not getting any errors or warnings. protected void BtnConfirmSignup_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=(localdb)\\MSSQLlocalDB

SqlDataAdapter does not fill DataSet

与世无争的帅哥 提交于 2020-01-11 07:03:08
问题 I'm using VS2012 and SQL Server Express 2008. I've boiled down my connection/query to try and find out why my DataSet is not being filled. The connection is completed successfully, and no exceptions are thrown, but the adapter does not fill the DataSet . The database that this is pulling from is on the same PC and using localhost\SQLEXPRESS does not change the result. Thanks for any input! SqlConnection questionConnection = new SqlConnection(ConfigurationManager.ConnectionStrings[

Casting Ado.net DataReader to IDataRecord giving strange result

不问归期 提交于 2020-01-11 06:40:56
问题 I have a query that I run against the database, and I can see that there is a record for 31/05/2013. When I run this query from C# with ADO.NET, and then use the following code, I am missing the record for 31/05/2013 var timeSeriesList = new List<TimeSeries>(); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { timeSeriesList = reader.Cast<IDataRecord>() .Select(r => new TimeSeries { MidRate = (double)r["MidRate"], RiskFactorName = (string)r["RiskFactorName"], SeriesDate =

Is DataSet slower than DataReader due to…?

橙三吉。 提交于 2020-01-11 03:16:07
问题 DataSets can be 10+ times slower than DataReader at retrieving data from DB. I assume this is due to overhead of DataSets having to deal with relations etc. But is the speed difference between DataSets and DataReader due to DataSets having to retrieve more data (information about relations ...) from DB, or due to application having to do more processing, or both? I assume DataAdapter uses DataReader under the hood and thus the number of commands application needs to execute in order to

Is DataSet slower than DataReader due to…?

徘徊边缘 提交于 2020-01-11 03:15:06
问题 DataSets can be 10+ times slower than DataReader at retrieving data from DB. I assume this is due to overhead of DataSets having to deal with relations etc. But is the speed difference between DataSets and DataReader due to DataSets having to retrieve more data (information about relations ...) from DB, or due to application having to do more processing, or both? I assume DataAdapter uses DataReader under the hood and thus the number of commands application needs to execute in order to

How to create a DbDataAdapter given a DbCommand or DbConnection?

和自甴很熟 提交于 2020-01-10 03:33:25
问题 I want to create a data access layer that works with any data provider. I know it's possible to create a DbCommand using the factory method available on the connection. objDbCon.CreateCommand(); However, I could not find anything to create a DbDataAdapter . Is this is a bug in ADO.NET or what? 回答1: DbProviderFactory.CreateDataAdapter * Also you can get all registered DbProviders via DbProviderFactories class. *I think this is a wrong place for this method. 回答2: As of .NET 4.5 , when writing

Execute a pl/sql function with OracleCommand

与世无争的帅哥 提交于 2020-01-10 02:09:06
问题 i have this pl/sql function, the only thing it does is validate that the user exist in the database, if the user exists this returns "Y" but if the user dont exist this return "N", what I want is get the value that I return in pl/sql in c #. I am using oracle 10g CREATE OR REPLACE FUNCTION KRIST.f_Login (userName IN VARCHAR2, password IN VARCHAR2) RETURN VARCHAR2 IS CURSOR USERFINDER IS SELECT IdEmpleado FROM EMPLEADO WHERE Usuario=userName AND Clave=password; id number; returnVal VARCHAR2(1)

Function Imports in Entity Model with a non-Entity Return Type

橙三吉。 提交于 2020-01-09 11:07:51
问题 I have a stored procedure in my Entity Data Model and added it to the function imports. Problem is... Visual Studio generates the function code in the model's code-behind if and only if I specify the return to be an entity type. Scalar and null return types do not work. Visual Studio does not generate the function code when I choose them. Is there something I am missing, or is this a bug? Any work-arounds? Using Visual Studio 2008 v9.0.30729.1 SP (Service Pack 1) 回答1: It's not so much a bug

Entity Framework Delete Object Problem

时光毁灭记忆、已成空白 提交于 2020-01-09 07:55:30
问题 i am getting "The object cannot be deleted because it was not found in the ObjectStateManager". while Deleting object. here is codes ; //first i am filling listview control. private void Form1_Load(object sender, EventArgs e) { FirebirdEntity asa = new FirebirdEntity(); ObjectQuery<NEW_TABLE> sorgu = asa.NEW_TABLE; foreach (var item in sorgu) { ListViewItem list = new ListViewItem(); list.Text = item.AD; list.SubItems.Add(item.SOYAD); list.Tag = item; listView1.Items.Add(list); } //than

Entity Framework Delete Object Problem

时光怂恿深爱的人放手 提交于 2020-01-09 07:55:09
问题 i am getting "The object cannot be deleted because it was not found in the ObjectStateManager". while Deleting object. here is codes ; //first i am filling listview control. private void Form1_Load(object sender, EventArgs e) { FirebirdEntity asa = new FirebirdEntity(); ObjectQuery<NEW_TABLE> sorgu = asa.NEW_TABLE; foreach (var item in sorgu) { ListViewItem list = new ListViewItem(); list.Text = item.AD; list.SubItems.Add(item.SOYAD); list.Tag = item; listView1.Items.Add(list); } //than