|
You're welcome
|
|
|
|
|
I am having a problem right now where I want to display multiple table data in the all the textboxs in a form.
Here's my coding:
Sub Fill_Template()
cmd.CommandText = "SELECT tblExpenses.Date, tblFoodAndBeverage.Breakfast, tblFoodAndBeverage.Lunch"
cmd.CommandText += "tblFoodAndBeverage.Dinner, tblFoodAndBeverage.Snack, tblFoodAndBeverage.Beverage"
cmd.CommandText += "tblFoodAndBeverage.Grocerries, tblFoodAndBeverage.Sub_Total, tblHousing.Rental"
cmd.CommandText += "tblHousing.Electricity, tblHousing.Water, tblHousing.Gas, tblHousing.Supplies"
cmd.CommandText += "tblHousing.Others, tblHousing.Sub_Total, tblTransportation.Bus_Fare"
cmd.CommandText += "tblTransportation.Taxi_Fare, tblTransportation.Train_Fare, tblTransportation.Fuel"
cmd.CommandText += "tblTransportation.Maintainence, tblTransportation.Others, tblTransportation.Sub_Total"
cmd.CommandText += "tblEntertainment.Video_Rental, tblEntertainment.Cinema, tblEntertainment.Concert"
cmd.CommandText += "tblEntertainment.Sport, tblEntertainment.Club_Bar_Disco, tblEntertainment.Games"
cmd.CommandText += "tblEntertainment.Others, tblEntertainment.Sub_Total, tblPersonalCareAndItems.Medical_Fees"
cmd.CommandText += "tblPersonalCareAndItems.Hair_Or_Nail, tblPersonalCareAndItems.Clothing"
cmd.CommandText += "tblPersonalCareAndItems.Supplements, tblPersonalCareAndItems.Soap_Or_Shampoo"
cmd.CommandText += "tblPersonalCareAndItems.Facial_Cleanser, tblPersonalCareAndItems.Others"
cmd.CommandText += "tblPersonalCareAndItems.Sub_Total, tblLoan.Personal, tblLoan.Student, tblLoan.Business"
cmd.CommandText += "tblLoan.Mortgage, tblLoan.Others, tblLoan.Sub_Total, tblLegal.Attorney, tblLegal.Alimony"
cmd.CommandText += "tblLegal.Summons, tblLegal.Others, tblLegal.Sub_Total, tblPaymentsAndOthers.Phone_Bill"
cmd.CommandText += "tblPaymentsAndOthers.College_Fee_And_Misc, tblPaymentsAndOthers.Vehicle_Payment"
cmd.CommandText += "tblPaymentsAndOthers.Vehicle_Insurance, tblPaymentsAndOthers.Vehicle_License"
cmd.CommandText += "tblPaymentsAndOthers.Credit_Card, tblPaymentsAndOthers.Debit_Card"
cmd.CommandText += "tblPaymentsAndOthers.Others, tblPaymentsAndOthers.Sub_Total, tblBanking.Maybank_Balance"
cmd.CommandText += "tblBanking.Maybank_Withdraw, tblBanking.Maybank_Deposit, tblBanking.CIMB_Balance"
cmd.CommandText += "tblBanking.CIMB_Withdraw, tblBanking.CIMB_Deposit, tblBanking.Public_Bank_Balance"
cmd.CommandText += "tblBanking.Public_Bank_Withdraw, tblBanking.Public_Bank_Deposit"
cmd.CommandText += "tblBanking.Other_Bank_Balance, tblBanking.Other_Bank_Withdraw, tblBanking.Other_Bank_Deposit"
cmd.CommandText += "tblExpenses.Allowance, tblExpenses.Total, tblExpenses.Wallet"
cmd.CommandText += "FROM tblExpenses, tblFoodAndBeverage, tblHousing, tblTransportation, tblEntertainment"
cmd.CommandText += "tblPersonalCareAndItems, tblPaymentsAndOthers, tblLoan, tblLegal, tblBanking)"
cmd.CommandText += "WHERE tblExpenses.Food_And_Beverage = tblFoodAndBeverage.Food_And_BeverageID"
cmd.CommandText += "AND tblExpenses.Housing = tblHousing.HousingID"
cmd.CommandText += "AND tblExpenses.Transportation = tblTransportation.TransportationID"
cmd.CommandText += "AND tblExpenses.Entertainment = tblEntertainment.EntertainmentID"
cmd.CommandText += "AND tblExpenses.Personal_Care_And_Items = tblPersonalCareAndItems.Personal_Care_And_ItemsID"
cmd.CommandText += "AND tblExpenses.Loan = tblLoan.LoanID"
cmd.CommandText += "AND tblExpenses.Legal = tblLegal.LegalID"
cmd.CommandText += "AND tblExpenses.Payments_And_Others = tblPaymentsAndOthers.Payments_And_OthersID"
cmd.CommandText += "AND tblExpenses.Banking =tblBanking.BankingID"
cmd.Connection = connection
da.SelectCommand = cmd
da.Fill(ds, "tblExpenses", "tblFoodAndBeverage", "tblHousing", "tblTransportation", )
For Me.i = 0 To ds.Tables("tblFoodAndBeverage").Rows.Count - 1
txtBreakFeast.Text = ds.Tables("tblFoodAndBeverage").Rows(i).Item(0)
txtLunch.Text = ds.Tables("tblFoodAndBeverage").Rows(i).Item(1)
txtDinner.Text = ds.Tables("tblFoodAndBeverage").Rows(i).Item(2)
txtSupper.Text = ds.Tables("tblFoodAndBeverage").Rows(i).Item(3)
txtSnack.Text = ds.Tables("tblFoodAndBeverage").Rows(i).Item(4)
txtBeverage.Text = ds.Tables("tblFoodAndBeverage").Rows(i).Item(5)
txtGroceries.Text = ds.Tables("tblFoodAndBeverage").Rows(i).Item(6)
txtSubFnB.Text = ds.Tables("tblFoodAndBeverage").Rows(i).Item(7)
Next
End Sub
I am having problem with the da.fill-with multiple tables(giving me error)
|
|
|
|
|
garyu87 wrote: I am having problem with the da.fill-with multiple tables(giving me error)
If you encounter an exception, then please, post the entire message. It helps in finding the cause of the problem.
In this case, it's probably caused by a malformed Sql-statement. Take a look at the concatenation;
cmd.CommandText = "SELECT tblExpenses.Date, tblFoodAndBeverage.Breakfast, tblFoodAndBeverage.Lunch"
cmd.CommandText += "tblFoodAndBeverage.Dinner, tblFoodAndBeverage.Snack, tblFoodAndBeverage.Beverage"
That would result in the string below;
"SELECT tblExpenses.Date, tblFoodAndBeverage.Breakfast, tblFoodAndBeverage.LunchtblFoodAndBeverage.Dinner, tblFoodAndBeverage.Snack, tblFoodAndBeverage.Beverage"
Can you see the problem? Those two items should be separated by a comma. I recommend putting the Sql-statement in a separate textfile, and to use File.ReadAllText to load it into the CommandText. That way you can write your Sql-statement in the Management Studio, and simply save it when you're done - and there's the benefit of not having to concatenate a lot if you save it in an external file. Third advantage is that you can update your Sql without a recompile
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I see...thanks for the tip but the compiler does not show any error.
My main problem is here:
da.Fill(ds, "tblExpenses", "tblFoodAndBeverage", "tblHousing", "tblTransportation")
Where there is 5 errors:
1. Value of type'system.data.dataset' cannot be converted into integer
2. Value of type 'String' cannot be converted to 'system.data.datatable'
3,4,5. Same as 3.
|
|
|
|
|
garyu87 wrote: Where there is 5 errors:
Those are the compiler-errors, and they tell what's wrong
A data-adapter has four overloads[^], none of which have that many strings.
Like I said, not much experience with table-adapters and data-adapters; it seems like you want to load multiple tables into a dataset; but the result of the select-query would be a single table, not multiple.
MSDN has a page[^] on the adapter-topic, which includes some examples - those might help
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Okay thanks for the info now I am calling the data one by one.
|
|
|
|
|
You're welcome
|
|
|
|
|
Hi All,
I'm new to Visual Basic
My question is: When i tried to execute the EXE in vb6 it is getting error as 'Run-time 430: class doesnot support automation or does not support expected interface'
I'm using Microsoft.Jet.OLEDB.4.0 in my component. I'm calling component from vb6, my component is made com visible.
I've tried googled for hours, but could not find solution to my problem .
Also i didnot register my component with regsvr32, but it is visible in COM.
Please help me out from this.
Also please explain why this problem has occured.
OS: Windows 7
Component developed on Visual Studio 2010
Please help me out.
Thanks,
|
|
|
|
|
Karthik Reddy wrote: I'm new to Visual Basic
Welcome to the wondrous world of programming! Now, uninstall VB6 and install VB.NET; VB6 has been developed a long time ago, and targeted a Windows-version prior to Win7. VB6 is no longer sold, no longer supported. VB.NET on the other hand, has a growing community, and it is free.
Karthik Reddy wrote: I've tried googled for hours, but could not find solution to my problem .
Because VB6 is not only old, it's actively being abandoned. If you "insist" on using VB6, then your best source of information are old second-hand books.
Karthik Reddy wrote: OS: Windows 7
Component developed on Visual Studio 2010
If you want to use a .NET control in your VB6-app, you'd best use the VB6 interop toolkit[^]. Contains a complete walkthrough and examples.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I also dont want to use this Visual Basic, but client wants to develop app in vb6
let me know if you have an answer to this ...
By the way, thanks for the instant reply
|
|
|
|
|
Karthik Reddy wrote: I also dont want to use this Visual Basic, but client wants to develop app in vb6
Since when do clients dictate which language we use? Does your client know the implications of this choice? Do they understand that there will be almost zero support?
If the client tells you that "strings" are bad, would you try to create a program that doesn't use strings?
Karthik Reddy wrote: let me know if you have an answer to this .
It's a generic error, and usually it includes the classname. It'll be caused by "any" of the components not being registered correctly, with MDAC being the prime suspect. You'd need to install the exact same version of the libraries that you developed against.
Hence the pointer to the VB6-Toolkit from Microsoft; it also explains what needs to be deployed and how, and the most common pitfalls. It's free to download, and it's created to help with mixing VB/.NET.
And again; if you are using .NET already, you'd have the dependency anyway. Why not write the whole thing in a modern language?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
The client has asked in vb6, if we guys develop in VB.NET then there is no point that we are serving the clients with their requirements.
And i don't understand that what should be the best version of MDAC to be installed on the machine. I've the latest 2.8.
Mr.Eddy Vluggen I can see my component in COM, still do I need to register my component with 'regsvr32' ?
|
|
|
|
|
Karthik Reddy wrote: The client has asked in vb6, if we guys develop in VB.NET then there is no point that we are serving the clients with their requirements.
You mentioned VS2010; sounds like you are already developing in .NET - what language is the component written in? And yes, I expect you to understand "why" the client proposes the requirement, as opposed to simply agreeing. Keep in mind that you're the programmer, you are the one who knows what the language-choice implicates, and YOU are the one responsible for using it.
Karthik Reddy wrote: Mr.Eddy Vluggen I can see my component in COM, still do I need to register my component with 'regsvr32' ?
Yes. You need to register your .NET control before you can use it in VB6.
That goes for all ActiveX controls.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
crieterion is to develop a component. We have done everything and sent to them..
After few days, all of a sudden he said he want the component to be used in vb6 applications.
Thank you for your suggestions !!
But my component is not registering with regsvr32.exe
|
|
|
|
|
Karthik Reddy wrote: After few days, all of a sudden he said he want the component to be used in vb6 applications.
I believe it's regasm[^], not regsvr. I tend to confuse them often; it's easier to search codeproject[^] for an article that has the procedure than it is to remember it after not using it for a few years. The CP-article shows all required steps, including registering.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Its working a bit now.
But error giving some error, i'll try to get rid of it.
Thanks Eddy Vluggen.
|
|
|
|
|
You're welcome
|
|
|
|
|
The component is in C#.NET in VS2010
|
|
|
|
|
Private Sub btnHostTools_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHostTools.Click
If GameActive Then
frmHostTools.Visible = True
Else
MsgBox("Please launch halo first!")
End If
End Sub
My problem is when the game isn't active it displays the message as it should, but the problem is that when the game does become active it will automatically show the form if you clicked the button when it was inactive.
How do I make it stop doing this, it's VERY annoying.
|
|
|
|
|
Disable[^] the button when it shouldn't be active. That way it won't be able to receive input (-focus).
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I have a table with student info.
It is possible for the user to enter the some
student 2 or 3 times, even if the studentId (primary Key) maybe diffirent. the first name, last name, classe ect may be the same.
If I have a student that have the same 6 fields the same I want to automatically delete them form the table remember the Student is set to auto increment.
thanks in advance
|
|
|
|
|
And your question/problem is what?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Member 9331278 wrote: It is possible for the user to enter the some student 2 or 3 times, even if
the studentId (primary Key) maybe diffirent
This may be true in your applications, but not in mine. If you're running into this, you did something very wrong, or not at all, during validation and data integrity checking before you wrote the record to the database.
Oh, you didn't check for duplicate data entered before you added the record?? Huh, that would explain why you've got this problem now, wouldn't it?
|
|
|
|
|
Member 9331278 wrote: It is possible for the user to enter the some
student 2 or 3 times, even if the studentId (primary Key) maybe diffirent. the first name, last name, classe ect may be the same.
Normalize your dataset; if an autonumber-key would solve all those structural problems, Access would have been a first-class development environment.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I am using Sql not access
can anyone help
|
|
|
|
|