|
Thank you ever so much for your help, unfortunately i am still receiving a few errors.
I ma probably doing something wrong but just want to clarify. Table name is the access file? or is it the table you have but in vb6?
And the First_Name is the column you want to search?
I have tried the code but am still receiving an error message. run time error 13
type mismatch
I think i'll glad to get this done and move onto a more up to date language!!!
Thanks again
Dan
|
|
|
|
|
offroaderdan wrote: I ma probably doing something wrong but just want to clarify. Table name is the access file? or is it the table you have but in vb6?
It's the name of the table, as it appears in the Access-file. Click on the Access-file one, hold down shirt, and double-click. That should open the database. The should be a list of tables. You can test your SELECT statement directly in Access, by creating a new Query.
offroaderdan wrote: And the First_Name is the column you want to search?
Yup
I'd go for something like this;
Dim con As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rst As ADODB.Recordset
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Northwind.mdb;User Id=admin;Password=;"
con.Open
cmd.CommandText = "SELECT * FROM [Employees]"
cmd.CommandType = adCmdText
cmd.ActiveConnection = con.ConnectionString
Set rst = cmd.Execute
rst.Close
con.Close
Set rst = Nothing
Set cmd = Nothing
Set con = Nothing
I are Troll
|
|
|
|
|
Thanks for the reply
I am currently getting an error saying unrecognized database format in vb6?
Umm the database file is all fine? I don't know why this has happened.
I have tried to code a different way as today one of my mates let me borrow a book in vb6 and i found a db way (so thought i'd try it)
has anyone ever come across this error and if so how do you get rid of it??
Many thanks
Dan
|
|
|
|
|
|
|
hi all,
i want to write the content of a text file to another txt file exactly like what i have in original file.
i used write,writeline and put functions. but to my surprise, i found the text file is benig written without the new line character.
for example:
original file content:
aefaiojefioae
fafajfpfjafaffjaeiofjafjfjfi
faijfoijf
faioj
Para 2:
fafaopfopfkaokfopfaopkfopkopafopkfpoaf. fijaoijij
fafijoifjfiajparwto
MY COPIED FILE content:
aefaiojefioae fafajfpfjafaffjaeiofjafjfjfi faijfoij ffaioj Para 2: afaopfopfkaokfopfaopkfopkopafopkfpoaf. ijaoijij fafijoifjfiajparwto
Can anyone help me on how to write the content of the file exactly as what i have in original?
Thanks,
mahi.
|
|
|
|
|
Why not just use system.io.file.copy?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
File.Copy is the simple way. Copying bytes, not characters (hence using a byte array), is the alternative.
|
|
|
|
|
Is the text in memory, or is it still in the original file?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
text is not in memory ..its in original text file only.
|
|
|
|
|
Then do what everyone else said, and just use File.Copy
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I agree. I think File.Copy would be your best solutions if you want your text file to be exactly the same as the original.
modified on Wednesday, January 27, 2010 10:02 AM
|
|
|
|
|
i have 2 following solution
the first
sqlcommand1.commandText = "insert into customers values('firstName','lastName','phone')
SqlCommand1.ExecuteNonQuery()
the second
'fill into datagridview
SqlCommand1.CommandText = "select * from customers "
SqlDataAdapter1.SelectCommand = SqlCommand1
SqlDataAdapter1.Fill(DataSet1, "customers")
DataGridView1.DataSource = DataSet1
DataGridView1.DataMember = "customers"
'add new row into datatable
row = DataSet1.Tables("customers").NewRow()
row.Item(0) = "firstName"
row.Item(1) = "lastName"
row.Item(2) = "phone"
DataSet1.Tables("customers").Rows.Add(row)
'update data
SqlCommandBuilder1 = New SqlCommandBuilder(SqlDataAdapter1)
SqlCommand1.CommandText = "select * from customers "
SqlDataAdapter1.InsertCommand = SqlCommandBuilder1.GetInsertCommand
SqlDataAdapter1.Update(DataSet1, "customers")
Can you tell me what 's difference between those ?
And which is solution with higher performance
Thank you very much!!
|
|
|
|
|
These two are doing different things, You cant Compare them. I suggest you buy a Book
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I see a lot of this.
Clearly the first is better etc. Why bother filling a dataset in order to perform an insert? The second option will produce the same SQL at the end of the day, but at high cost in processing to generating something you can type yourself in seconds.
|
|
|
|
|
The first one is a little better than the second b/c your using a bit more processing power on your app server to create the dataset you have on the second. In the first, most of the processing will be performed on the database server which is optimized for doing such computations.
modified on Wednesday, January 27, 2010 10:01 AM
|
|
|
|
|
Dear All,
Could any body give me the line code for the given query.
1. If I am clicking mouse button on Row 1 column 3
then it will show in Msgbox "selected Column 3"
2. If I am clicking mouse button on Row 1 column 4
then it will show in Msgbox "selected Column 4"
.........so on.
Thanks
Ashish
|
|
|
|
|
Private Sub MSFlexGrid1_Click()
MsgBox CStr(MSFlexGrid1.Colsel)
End Sub
I are Troll
|
|
|
|
|
Hi,
The below code return 0 ,Even I click on 1,2.3 ...soon column
Private Sub MSFlexGrid1_Click()
MsgBox CStr(MSFlexGrid1.Colsel)
End Sub
Thanks
Ashish
|
|
|
|
|
Ashish Kumar Vyas wrote: The below code return 0 ,Even I click on 1,2.3 ...soon column
Ah, the selection isn't there yet when you click it, so one would have to check what column the mouse is on;
Private Sub MSFlexGrid1_Click()
MsgBox CStr(MSFlexGrid1.mousecol)
End Sub That should fix it
I are Troll
|
|
|
|
|
I Have made a program to set the master volume in XP, but with Vista and Seven this don't work. How to fix this with VB6? THanks!
|
|
|
|
|
You're going to have to do some more research on this, but here[^] is a start.
|
|
|
|
|
Experts i need your help!
I have a database with a search option when a record is selected i want the option for them to sign that record off (checkbox type thing) however at the moment the database seems to be ONLY READ only???
How can i make it so i can initially add bits and pieces to the record or if worse come to worse delete that record?
Many thanks
Dan
|
|
|
|
|
Make the database not "read-only"
|
|
|
|
|
What type of database? SQL Server, MySql, Access, etc...
|
|
|
|