Hello, I have a problem trying to connect to an Access Database, the problem is that I want to make a working project without thecontrols, I only need the source code to do that. I would like to know about working with databases without using the bindingnavigator, how can i do that. I don't know, please help!!!:D

Databases!!!
Brick IM Robot
John D Wilson
//I have to go one by one comparing the strings
No, that would be the slow way to do it.
Dim QueryString As String = "SELECT Orders FROM Table1 where Orders LIKE '%fish%'"
would return any order that contained the word 'fish'. LIKE uses % as a wildcard. You can also use =, as in
Select * from Table1 where OrderID = 12 AND Order = 'Fish and chips'
So, with a where clause, you use single quotes for strings, and no quotes for numbers.
SathyaKV
Hello Again!
I have a problem trying to enum the records, I'm using this cod
Public
Function GetRowValue(ByVal QueryCount As String) As Integer Dim NumValue As Integer Using Conn As New OleDbConnection(ConnectionString) Dim command As New OleDbCommand(QueryCount, Conn)command.Connection.Open()
NumValue = command.ExecuteScalar()
End Using Return NumValue End FunctionThe the Example Table is:
ID Work
1 Painter
2 Farmer
3 Doctor
4 Teacher
...
...
1000 Student
Im usin this Command
"SELECT COUNT(Wprk) FROM Jobs"
whit smaller tables this code works but with this table doesn't, is there any other way
MarkAtherton
Thanks for tip, I'm going to use this code you gave me!!. it's very helpfull.
I can use the READ statement as a True indicator right like
If Reader.Read Then
'Here goes the procedure! End IfJeek
one more thing you use reader to put text in your textbox, i don't think this is a good idea
for example if your reader have 10 records to read , your textbox will just show up the last one and you lose the rest, try to use other control that can contain a collection
hope this helps
Stormsys
I believe so, yes.
Toby Sharp
I imagine the code in this article will cover what you want to know, there's lots of similar articles on that site as well:
http://www.codeproject.com/vb/net/atcl.asp
MatrixObjects
hi,
i think you are right, but the point is what you want to do will need lots of explanation , so i guess its better to review this page first and if anything stopped you we are here to help
http://msdn2.microsoft.com/en-us/library/ms171918(VS.80).aspx
to be able to deal with Access Database use OleDb not SQLClient http://msdn2.microsoft.com/en-us/library/system.data.oledb.aspx
Connecting and Retrieving Data in ADO.NET >>> http://msdn2.microsoft.com/en-us/library/ms254937.aspx
hope this helps
SteveNash72
I hear you.
I work with Access Databases in VB 2005. What specific questions do you have
justncase80
Hey there, the information you game me is very good, I'm working right now in the database, but I have only one more Question..
Is there any way that I can sear into a databes for a string cause I'm using the next code:
Dim ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Sample.mdb" Dim QueryString As String = "SELECT Orders FROM Table1" Using Connection As New OleDbConnection(ConnectionString) Dim Command As New OleDbCommand(QueryString, Connection)Connection.Open()
Dim Reader As OleDbDataReader = Command.ExecuteReader While Reader.Read '**************************** ' Then I use here the compare method that is not typed yetTextBox.Text = (Reader.GetString(1))
'********************************* End WhileReader.Close()
End UsingSo my question is that if I can use other method than the READ one to make this happend or I have to go one by one comparing the strings
Thanks for all your help!!.
Steve at Clemson
Now, Renee, you knew you couldn't go and say something like that and not have me completely disagree with you
Not using SQL to access data would be the same as buying a car and pushing it to work. Absolutely do NOT do this unless you have religious reasons for not using SQL. SQL is how databases work. No matter how small your task, it is always going to be slower to do it by iterating through tables in code, even if you don't notice. You'd do better to do the job using the best tools, and not establishing any bad habits.
Plus, a line of SQL is easier to write than a page of code.
Prashant Utekar
That SQL looks fine, have you tried COUNT(*) Also, what do you mean by it doesn't work, what happens
If no record is ever deleted, you can
select MAX(ID) from Jobs
swivel
Hey thaks for the reply
the message error is this:
"Error de sintaxis en la clausula FROM"
Bbut I cant use, Count(*) because I have more that one column in the table, and I only need the row count for that colum, something like the next table
ID Work Study
1 painter yes
2 farmer no
3 doctor "this field and the next ones to 1000 are empty"
...
1000 teacher
Pingel
Yes, I would agree with you and I'd recommend not bothering with SQL to do this.
Take it in steps.
Open the Database(s) with ADO.NET.
Get the tables
Itterate through them in that order.
It's very simple.