|
For future reference, if you're writing an ASP.NET site or a Windows Forms app with database access from multiple threads, you don't want to use a Access database with it. Access doesn't take very well to multithreaded environments and may throw the error you posted if you do.
|
|
|
|
|
Jesus H Christ... Someone votes me a 2 for this?? Do I REALLY have to dig up the documentation behind this statement?? FINE!! Here it is:
.NET Framework Data Providers (ADO.NET)[^] It's in the second yellow "Note" box on the page.
|
|
|
|
|
Check this CodeProjectForums .com
|
|
|
|
|
This error normally occurs when you are using a column name that is reserved keyword in Access. You don't give us any info on the column names but I would suggest you try using a full SELECT statement putting square brackets around the field names. Something like this
SELECT [Field1], [Field2], [Field3] FROM YourTable WHERE [Current_Date] BETWEEN @StartDate AND @EndDate
Hope this helps.
...and I have extensive experience writing computer code, including OIC, BTW, BRB, IMHO, LMAO, ROFL, TTYL.....
|
|
|
|
|
Thanks for your help. My problem has been solved.
Gagan
|
|
|
|
|
Hmmm... Good to know. I didn't catch it because I don't use Access for anything. I always go for some flavor of SQL Server.
|
|
|
|
|
Yeah, I remembered that from years back. I now use MySQL exclusively.
...and I have extensive experience writing computer code, including OIC, BTW, BRB, IMHO, LMAO, ROFL, TTYL.....
|
|
|
|
|
Can anyone help me on how to display the records of the table from sql server on the treeview control.
Note: I only want is to display the records only on the column1.
|
|
|
|
|
daemonsead2008 wrote: I only want is to display the records only on the column1.
There is no column in TreeView, did you mean a ListView?
And what is the structure of your table? Is it hierarchical? TreeView is used to display hierarchical information.
|
|
|
|
|
I develop and support a simple VB .Net data acquisition application for a University. A request came in from one of our Spanish clients to have the numbers display on the gui in their local numerical format where the decimal point and comma are swapped from their customary positions in the US. In Windows 7, I can easily change the number format using the control panel and in fact this does change the format for most of the numbers in the application with no programmatic intervention on my part. For instance, voltage readings are displayed in text boxes in the appropriate format, but for some values which are assigned to the TEXT property of a label are still displayed in the US format. I have seen a lot of discussions regarding setting the locale on the thread but I would prefer not to have to intervene that way. My question is how do the numbers display properly sometimes but not others automagically? Is their a property on the text box or label that turns on this on? I suspect it has to do with how I assign values to text properties. I use the FORMAT method as
Textbox.TEXT = format(1.0,"0.0")
but I also tried this with the label with little success. Is this because the numbers assigned to text boxes are changing dynamically while the label text is static after loading? In insight would be appreciated.
Regards,
Bob
|
|
|
|
|
bobmc11 wrote: Textbox.TEXT = format(1.0,"0.0")
Where did the format function come from?
You can try using this:
txtBox1.Text = myNumber.ToString("c");
For a more detailed explanation, go through this[^] article.
|
|
|
|
|
Hi all...
When I execute update query, I get error "data type mismatch in criteria expression"
I used following code :
Try
DBConnection.connect() 'code to open database.
Dim sql As String = "update MortgageDetails set [Borrower_Name]='" & txtBorrowerName.Text & "', [Caste]='" & txtCaste.Text & "', " & _
"[Area]='" & txtArea.Text & "', [Address]='" & txtAddress.Text & "', [Product_Detail]='" & txtProductDetail.Text & "', " & _
"[Current_Date]='" & txtCurrentDate.Text & "',[Current_Value]=" & txtProductValue.Text & "," & _
"[Amount_Borrowed]=" & txtAmountBorrowed.Text & " where [S_No]=" & txtSNo.Text
Dim cmd As New OleDbCommand(sql, con)
cmd.ExecuteNonQuery()
MsgBox("Record Updated!", MsgBoxStyle.Information)
Me.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
I am using VB2008 and MS Access 2003 as database.
Suggest me what to do.
Thanks.
Gagan
|
|
|
|
|
Sounds like you are passing some data to the table as text when it should be numeric or some other non string format but without seeing your table definition its hard to say something else.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Passing literal data like that always is asking for trouble. The exact problem is most likely the date you have there. Passing dates and other non-string types depends on the exact database you use, and is often problematic.
Suggestion:
1. use programming variables, and TryParse() your textual input before passing the info to the database; this traps input errors and avoids SQL injection;
2. use SqlParameter and pass the above variables; don't use literals in SQL.
In will take a bit more code, but the result will be much more robust.
|
|
|
|
|
Seems the problems is with this piece of code:
"[Current_Date]='" & txtCurrentDate.Text & "'"
Access expects dates to be passed in a specific format, try this:
"[Current_Date]=#" & Convert.ToDateTime(txtCurrentDate.Text).ToString("MM/DD/YYYY") & "#"
|
|
|
|
|
Thanks for your answer. It worked.
|
|
|
|
|
You're welcome. Please mark it as answer so your post doesn't appear unanswered.
|
|
|
|
|
Hi,
I'm developing a VB.NET application that manipulates 6 Excel files and genetates one sinle Excel file using data stored in those 6 files. This is needed to make my job easier.
I'm assuming those excel files as database tables, and in order to create my final excel (like View/Query in databases) i need to get data from each of the excel files (like taking maching columns OR joins).
The way I want to implement the application is: taking each excel files from OpenFileDialogs in VB, running SQL queries on those excel files, and generating the necessary excel file by a single button click.
I think I could explain the case well and you understand everything with the situation..
Now, the question is:
1. Can I run sql queries on excel columns?
2. Wouldn't it be too slow if I have 63000 rows in some of my excel files?
3. If yes, can you give me some code samples to run SQL Queries on two (already exist) excel files and generating the third-one based on these files (like what we do in database views)?
Your help will be really appreciated!!!
thx.
modified 6-Oct-18 21:01pm.
|
|
|
|
|
|
Wouldn't it be too slow to work with worksheets which contain 65000 rows?
modified 6-Oct-18 21:01pm.
|
|
|
|
|
Why don't you try it and benchmark against a sql example. (The Excel solution will definitely be slower.)
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
IMHO with OleDb, creating connection will be a bit slower but querying data should not be.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
You are correct on a single client, although across a network is a different story.
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
Vista\Win7 - Is it possible to shell and specify an account to run the process under?
Scenario: our company has a program that is a launcher app (kinda like a fancy version of click-once). Based on the arguements passed in, it determines what program the user is trying to run and what files need to be updated (controls, .dlls, etc), pulls them down from a shared directory and registers them (regsvr32 or regasm). After that process is done, the program that was requested is launched via shellex.
In Vista and Win7 the regsvr32 and regasm functionality is broken because of UAC. The user has admin rights to only 1 folder in the Program Files directory (that is the location where the .dlls, etc are pulled down to). Is there a way to perform a shell (so that regsvr32 can be run) using a admin account (specifying user and password in code)?
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Try launching regsvr32 like this:
System.Diagnostics.Process.Start("regsvr32.exe", username, password, domain);
|
|
|
|