sql,vb.net,oledb,datareaderRelated issues-Collection of common programming errors
Jasper
java sql hibernate db2
Hibernate criteria, using DB2 dialect, generates the following SQL with composite keys in the IN clause, but DB2 answers that the query is incorrect:select * from tableA where (x, y) IN ( ( ‘x1’, y1) )but, DB2 throws this:SQL0104N An unexpected token “,” was found following “, y) in ( (‘x1′”. Expected tokens may include: “+”. SQLSTATE=42601
bibliofilo bibliofilo
sql nexusdb
NexusDB: Query1058317796: Query execution failed: Unexpected exception object raised: [EAssertionFailed] Assertion failure (C:\DSN\WIN\lib2006\Fontes\Externos\NexusDB2\nxsrBufferManager.pas, line 1115) [$3CA1/15521]i tried this sql SELECT * FROM “Operaca”, “Pessoas” Many joins dot not work in my database!!!help!!
Johnsyweb
php mysql sql
I have a database where I have an email field, among others.When I do a SELECT statement like : SELECT * FROM table_name WHERE email = ‘[email protected]’;…it returns an empty set, even though I can see the entry in the table.The same statement works when I use:SELECT * FROM table_name WHERE fname = ‘abcd’;What could be going wrong?
OMG Ponies
sql mysql aggregate-functions
I’m just learning MySQL – is there a way to combine (or nest) aggregate functions?Given a query: SELECT user, count(answer) FROM surveyValues WHERE study=’a1′ GROUP BY user;This will give me the number of questions answered by each user. What I really want is the average number of questions answered per user…something like:SELECT avg(count(answer)) FROM surveyValues WHERE study=’a1′;What’s the correct way to compute this statistic?If this is possible, is there a way to then break this statisti
deepak
sql select sqlite3 inner-join
I have two tables, related by a foreign key. I want to select a column from the child table based on some information about a row in the parent table. The definitions of the tables are:CREATE TABLE Runs(id INTEGER, name TEXT UNIQUE NOT NULL, rundate TEXT NOT NULL,PRIMARY KEY (id) );CREATE TABLE Location(lid INTEGER, rid INTEGER NOT NULL,direc TEXT NOT NULL,PRIMARY KEY (lid), FOREIGN KEY (rid) REFERENCES Runs(id) );I am new to SQL so I have no
Steve Dignan
sql performance
Is there any difference (performance, best-practice, etc…) between putting a condition in the JOIN clause vs. the WHERE clause?For example…– Condition in JOIN SELECT * FROM dbo.Customers AS CUS INNER JOIN dbo.Orders AS ORD ON CUS.CustomerID = ORD.CustomerID AND CUS.FirstName = ‘John’– Condition in WHERE SELECT * FROM dbo.Customers AS CUS INNER JOIN dbo.Orders AS ORD ON CUS.CustomerID = ORD.CustomerID WHERE CUS.FirstName = ‘John’Which do you prefer (and perhaps why)?
Jean-Philippe Bond
sql db2
I have DB2 and I have the following QuerySELECT t1.MyName, t2.MySalary FROM Employee t1 CROSS JOIN Salary t2I got the following Exception :An unexpected token “CROSS” was found following “me FROM “Employee”t1 “. Expected tokens may include: “”.. SQLCODE=-104,SQLSTATE=42601
Eoin Campbell
.net sql sql-server
I am trying to execute following syntax under transaction but it throws error:-this is the script that I am executing under transaction:-IF (1 = FULLTEXTSERVICEPROPERTY(‘IsFullTextInstalled’)) — full text search is installed. Run the necessary procedures BEGINdeclare @dbName nvarchar(128)select @dbName = DB_Name()exec(‘ALTER DATABASE [‘ + @dbName + ‘] SET RECOVERY SIMPLE’)if(0 = DATABASEPROPERTY(DB_Name(),’IsFulltextEnabled’))BEGIN– Full text is installed but not enabled on the Database. Enabl
Mahmoud Gamal
sql postgresql
How is it possible that the order of columns matter in a distinct. I get a different number of rows forSELECT DISTINCT ON (the_geom,plz) the_geomand SELECT DISTINCT ON (plz,the_geom) the_geomAny ideas where I am thinking wrong? I am using postgreSQL 9.1.5.
Darren Sweeney
mysql sql
On a table where user_id is INT Why is:SELECT * FROM tableName where user_id = 63recommended instead ofSELECT * FROM tableName where user_id = ’63’
TeddyRuxpin
vb.net generics lambda
I have this function in vb.net that I converted from C# for a project I’m working on.Private Function GetAllFactory(Of T)(ByVal ctor As Construct(Of T)) As List(Of T)’TODO: Data Access stuff Dim ds As New DataSet()Dim entities = New List(Of T)()For Each dataRow As DataRow In ds.Tables(0).RowsDim entity As T = ctor(dataRow)entities.Add(entity)NextReturn entitiesEnd Functionand the following delegatePrivate Delegate Function Construct(Of T)(ByVal dataRow As DataRow) As TI tried converting the code
taswyn
vb.net json wcf
I had a WCF that returned first-name and last-name. It has been working well. I then modified the service to return one more piece of data. It returns null in that field. Also, the ordering seems to be messed up. The newly inserted field is inserted in-between the first and the last name. So now it returns:”firstname”: “John”,”fullname”: null,”lastname”: “Doe”,
swolff1978
c# asp.net vb.net error-handling
Here’s a question where my real world programming inexperience shines through. I have a function which makes a call to three other functions:Public Sub StartService()RunSearch()SaveMessages()DeleteMessages() End Subwithin each of the methods RunSearch(), SaveMessages() and DeleteMessages() I am using Try Catch statements to catch errors. Right now I catch the error and write to an error log when RunSearch() errors out, but I’m also get two errors from SaveMessages() and DeleteMessages() becaus
tr2962
vb.net wcf list service arraylist
I am currently utilizing a WCF service (web) to pass values to my application. The service is hosted offsite and I’m communicating with it well. The problem I have is how do I collect the items from an array that’s created on the host side?
user194076
asp.net xml vb.net
I need a snippet to check file for validity (I’m allowing users to upload xml files). So I need to check whether uploaded file is XML. The best I can think of is just check if extension is “.xml”. What if its replaced?
RyanHecht
vb.net
For a final project in my Visual Basic class, I am making a Windows Forms version of Battleship (I call it “NavalQuest” :p). There is a form for each player’s board, and I have a .vb file for public shared information. In this file, I have a Public Shared Sub called “Place” to be called when ships are being placed. Here is what I have to head the sub:Public Shared Sub Place(ByRef form As Form, ByRef board(,) As PictureBox, ByRef picbox As PictureBox)Where “form” is the form from which the Sub is
XK8ER
c# vb.net
I am doing some tests with different characters in the title of a listview. for some reason the exact same app displays fine on win8 but it doesnt show a check mark in winxp.. how do I fix this on .Net Framework v4?
GEOCHET
vb.net visual-studio user-controls
I have created a custom control that is included in a control library that is referenced by a VB Forms application.When I modify the control, and have the application open in a VS window, VS usually asks me if I want to reload items that have changed.However, a couple of times, it has not asked me this, and when I go to open the form that contains the modified control, I get an error window warning me that if I ignore the error message and continue, then I risk making VS unstable. I’ve learned t
Jeff Bridgman
vb.net return-value assignment-operator
What’s the return value when I do an assignment?For example, can I do this? (i.e. the assignment returns the value being assigned)Dim a As Integer = 1 Dim b As Integer = 2 a = b = 3The question came up when I wrote this code today:Dim updates = GetUpdates() While updates.Count > 0Foo.ApplyUpdates(updates)updates = GetUpdates() End WhileI kind of wish I could have written it this way…While (updates = GetUpdates).Count > 0Foo.ApplyUpdates(updates) End WhileI know it’s not as clean… (and
Abe Miessler
vb.net
i have one windows form application in v s 2010. i want to maintain a FLAG in Which there is two values of FLAG1) yes and 2) noi want that when a form is load a Flag value is yes and The form is close the flag value is no in my back end DatabaseIt is same like sing in person on any web site…..But my Problem is that how can i maintain it any how the my computer is turn off ……. i store a database on single computer that is server.but i also want a code for on same computer,also
user900973
asp.net vb.net oledb
How do I fix this error? I’m using asp.netCompilation ErrorDescription: Error compiling a resource required to service this request. Review your source file and modify it to fix this error.Compiler Error Message: CS1519: Unexpected symbol `Dim’ in class, struct, or interface member declarationSource code:<%@ Import Namespace=”System.Data.OleDb” %><script runat=”server”> sub Page_Load Dim dbconn As OleDbConnection dbconn=New OleDbConnection(“Provider=SQLOLEDB; Data source=’http://loca
lmolino
c# c#-4.0 oledb nullreferenceexception
My objective is to connect to an mdb database (stored locally), go through it and get the following information:-The names of all the tables present in the database-The name of the columns AND their type in each table of the database.While developing the code I used the code indicated in the answer to the following stackoverflow questionneed to find the type of the column of DBI implemented the code written in the accepted answer and tailored it to my needs. Here is what I have so far:DataSet dt
abatishchev
sql-server excel ssis oledb
I have an SSIS package which reads an Excel File (Data Flow Source) and transfer the data to SQL Server using OLEDB Destination Data Flow Item. The OLEDB Connection Manager used for the destination is configured to use Windows Authentication. The package works fine on my development machine. But when I open the same package on another machine and try to execute it gives the following error in Validation phaseError: 0xC020801C at DFT_NSOffers, Source – ‘Subscription Offers$’ 1 [347]: The AcquireC
p.campbell
sql-server-ce oledb compact-database
Using the SQL Compact version 4.0 from Microsoft SQL Server Compact 4.0, I’ve created a new compact database on E:\tmp\EmbSQL.sdf with SQL Studio.Trying to connect from Excel Macro:Set conn = CreateObject(“ADODB.Connection”) strCnxn = “Provider=Microsoft.SQLSERVER.CE.OLEDB.4.0;Data Source=E:\tmp\EmbSQL.sdf;” conn.Open strCnxnGetting the following error:’Runtime Error -2147467259 (80004005)’.Any hint on what’s going wrong?
Strikerz
c# .net odbc oledb
I need to create a service that would be able to Get data from a table in defined format from all specified connection strings. Connect to variety of databases types. I imagined it would look like thisinterface IDataConnectorModule { Model PullData() } All I need to do when I’ll support new database type to implement the interface for new class lets say, OracleConnector, MySQLConnector,… and then use them in runtime to retrieve data. What is the best API’s to achieve this? Taking the performan
user57087
database vb.net visual-studio-2008 ms-access oledb
I’m working on a VB2008 project that references two Access databases using Provider=Microsoft.Jet.OLEDB.4.0;It would seem if the user does not have MSOffice on their machine, the program crashes with a “XXX stopped working” on startup on Vista and Win7.I thought that Windows had XP and above had Jet functionality built in? Does anyone know why this is happening? What are the correct project/publish/prerequisites required please?TIA
Bridge
.net database oledb jet
I am trying to understand using of variety of databases for research, recently I’ve been studying Jet OLEDB. In some source code I saw this:Provider=Microsoft.Jet.OLEDB.4.0; Data Source=ComSys;What is this ComSys? Is it a path To somewhere? If so, where?
VMAtm
c# winforms permissions oledb trust
How can i change Trust level? I writing c# windows form app with oledb and can’t use append query because access disable mode prevent that.
abatishchev
c# ms-access ado.net oledb
I was checking about access database connectivity with c# in social of MSDN where i found the sample connection string as follows string ConnStr = @”Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\abc.mdb;Jet OLEDB:Database Password=password”;Now my question is suppose i have created a form application and i put the database file abc.mdb at the same location where the .exe file resides. In that case can i write the connection string as follows?string ConnStr = @”Provider=Microsoft.ACE.OLEDB.12.
j0k
c# asp.net asp.net-mvc ms-access oledb
I am trying to load data using following code.string path = System.IO.Path.GetFullPath(uploadExcelFile.PostedFile.FileName);string connString = “provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Rizwan shahid\\Desktop\\DataUpload\\Req.xls;Extended Properties=Excel 12.0;”;OleDbConnection oledbConn = new OleDbConnection(connString);try{oledbConn.Open();OleDbCommand cmd = new OleDbCommand(“SELECT * FROM [Sheet1$]”, oledbConn);OleDbDataAdapter oleda = new OleDbDataAdapter();oleda.SelectComman
Matt
asp.net sqldatareader datareader dataprovider sqlhelper
Note: You may not need to read the whole thing to know what’s wrong… skip down to the part about the 3 scenarios if you’d like. Only read the begin if you’d like some background info on how I’ve tried implementing this and where the errors occurred.To begin with, I’m trying to retrieve a list of Clients stored in the CRM_Clients table for a given callerId.I retrieve the clients from my Controller with the SelectLiveClientsForCaller method. The message is then passed on to the DAL through the s
DH_Prog
c# sql exception datareader using-statement
I have an application in which I have to get a large amount of data from DB. Since it failed to get all of those rows (it’s close to 2,000,000 rows…), I cut it in breaks, and I run each time the sql query and get only 200,000 rows each time.I use DataTable to which I enter all of the data (meaning – all 2,000,000 rows should be there).The first few runs are fine. Then it fails with the OutOfMemoryException.My code works as following:private static void RunQueryAndAddToDT(string sql, string las
Tim Coker
c# tostring datareader
Is there a difference between DataReader[0].ToString() and (string)DataReader[0]?My guess is that (string)DataReader[0] might fail if the database type isn’t a string type, where DataReader[0].ToString() would just convert anything outside of a DB null to a string. Is that the case?Which would be faster?
adkSerenity
sql vb.net oledb datareader
I’m trying to create a program which has a datagridview, when the user clicks on a cell in the view, it then looks in a SQL database, grabs information from other fields in the same record, and automatically fills corresponding text boxes (done by manipulating the name of the field) in the form.For some reason however, I’m getting an error message saying: “InvalidOperationException was unhandled” “No Data exists for the row / column”Here is the code relevant to this part of the program:Private S
SchlaWiener
c# mysql datareader mysql-connector mysqldatareader
I have two tables orders and orderdetailstable orders (PK = id, UNIQUE index on orderno)|id|orderno| | 1|1000 | | 2|1001 |table orderdetails (PK = id)|id|orderid|item|qty| | 1| 1|ABC | 3| | 2| 1|XYZ | 4|Now I want to query the data with:SELECT o.orderno, od.item, od.qtyFROM orders oINNER JOIN orderdetails od ON o.orderno = od.orderwhich returns:|orderno|item|qty| |1000 |ABC | 3| |1000 |XYZ | 4|However If I use the following code to load the result into a DataTable it fails:
user2395495
c# microsoft-metro async-await datareader await
I have a server running on my laptop and am trying to use StreamSocket to communicate with it. Everything is working fine. I can send and receive messages but I have one big question.var reader = new DataReader(clientSocket.InputStream) {InputStreamOptions = InputStreamOptions.Partial}; Thread.Sleep(1000); var actualLength = await reader.LoadAsync(33554432); // Buffer of 32 MBIn this section of my code I have to use Thread.Sleep(1000) in order for my DataReader to fill itself up and move on with
bEtTy Barnes
mysql vb.net datareader
I have encountered this problem:ERROR: There is already an open DataReader associated with this Connection which must be closed first.Please have a look on my code:Dim sqlQuery As String = “SELECT * FROM users”Dim myAdapter As New MySqlDataAdapterIf txtUsername.Text = String.Empty And txtPassword.Text = String.Empty ThenMsgBox(“Enter username and password”, MsgBoxStyle.Exclamation, “Tea Sparkle POS”)ElseDim sqlquerry = “Select * From users where username = ‘” + txtUsername.Text + “‘ And password
casperOne
c# odbc datareader
In my C# code I have an ODBC datareader that’s the results of a call to a stored procedure with a parameter. When running the program by the customer, while retrieving the results from the datareader , using a while loop, at some point it will stop by the rdr.Read() command and just stand by for an undefined number of minutes and then continues.while (rdr.Read()) {Somecode…}What could cause this behaviour?
Brian
c# .net oledb datareader
I’m trying to import data from an Excel (xls) spreadsheet. I need to throw an error if duplicate values appear in the header row. I’m using an OleDbDataReader to ingest the worksheet data. The problem I’m having is that .Net is appending a unique integer to the end of the duplicate columns so that all of the values are unique.The header values will be be unknown at runtime. If duplicate header values are found, processing of the file should be stopped.For example, a spreadsheet with the followin
Web site is in building