How are you connecting to the database? If you are using ODBC, you need to create a like ODBC element on the new computer.
Hoppy
How are you connecting to the database? If you are using ODBC, you need to create a like ODBC element on the new computer.
Hoppy
Sure, where would you like the contents of the variable (say myHTML) to come from? It could be read from a file, it could be passed in from the old web page.
Regardless of the source, you can write it out by:
<% response.write(myHTML) %>
Hoppy
When I inserted while(TRUE) it gave me an error saying that TRUE was undefined. Was that supposed to be while(true) ?
I went through the program and changed some of the functiions from ints to voids. For checkPrime, I now have it set to return 1 if it is not a prime and 0 if it is, so I kept it as an int.
Now, however, I get an error for line 102. It says error: expected declaration or statement at end of input.
Also, can anybody help me figure out an easy way to store the digits of an integer as an array or a string?
#include<stdio.h> #include<stdlib.h> #include<stdbool.h> #include<math.h> int enterNewNumber(); void printReversed(int); void checkPalindrome(int); int checkPrime(int); void printPrimeFast(int); void printPrimeSlow(int); void printPrimeFactors(int); int main(void){ int choice; int number; while (true){ printf(" 1. Enter a new number.\n 2. Print number reversed.\n 3. Check if number is a palindrome.\n 4. Check if number is prime.\n 5. Print all prime numbers up to number (slow).\n 6. Print all prime numbers up to number (fast).\n 7. Print the prime factorization of the number.\n 8. Quit\n"); printf("Please select an option from the list: "); scanf("%d", &choice); printf("You selected choice %d.\n", choice); switch(choice){ case 1: number = enterNewNumber(); break; case 2: printReversed(number); break; case 3: checkPalindrome(number); break; case 4: checkPrime(number); break; case 5: printPrimeFast(number); break; case 6: printPrimeSlow(number); break; case 7: printPrimeFactors(number); break; case 8: exit(0); break; default: printf("Your choice was invalid.\n Please choose a number from the list.\n"); main(); } } return …
I can remember a few years ago (well maybe more than a few) all of the planets, except one lined up almost exactly. Everyone wondered what would happen.
There were all sorts of goofy theories floating around. The day came, the day went, nothing happened. Nothing will happen this time either, unless maybe Colonel Sanders gets his hands on Chicken Little.
Hoppy
Where do you want to get the name of the database from? The choices are to hard code it, (not your favorite obviously), to pass it as a parameter to the application via the command line (not my favorite approach), to store it in a parameter file, the name of which can be specified on the command line used to open the application (my favorite approach), to create a form that asks the user to enter it. Maybe you can think of some other ways as well.
Name your poison,
Hoppy
That code looks just fine to me. But sometimes looks can be deceiving. Are you sure that what looks like a space between "IDM_MY_MENU" and "208" is really a space. I remember once having a similar problem. It turned out, after hours of desperation that there was actually an undisplayable character there. If found this out by looking at the file in hex using the debug program in a DOS box. I really can't think of anything else other than that.
Hoppy
I'm not sure why you don't like the code you have if it works, but just in case you're interested, this is the way I ususally do it:
Dim wrkJet As Workspace
Dim dbProgram As Database
Dim wOrders As Recordset
Set wrkJet = CreateWorkspace("", "Admin", "", dbUseJet)
Set dbProgram = wrkJet.OpenDatabase("myDBName.mdb")
Set wOrders = dbProgram.OpenRecordset("SELECT * FROM Orders ORDER BY OrderNumber", dbOpenSnapshot)
.
.
.
If you want to learn C or C++, I suggest you look at "www.cprogramming.com". I have not gone through the site, but judging from the table of contents, it might be just what you want. Let me know if it helps you.
Hoppy
OK. Frankly, I don't really know what this code is intended to do, because I can't see the entire program. But, I'll try to respond to the questions you have posed.
Firstly, the statement "HINSTANCE hInstance;" simply declares that hInstance is an object of type HINSTANCE. HINSTANCE is probably a class. Classes typically contain properties (variables of either some atomic type (int, char, etc. or complex variables which are classes themselves) and methods (functions that do work on behalf of the class.
From the code, it looks like hInstance is being initialized from hInst. The code that sets hInst is not shown.
hPrevInstance and hThisInstance are parameters of type HINSTANCE that are being passed to WinMain from the code that calls it.
Again, the purpose of all this (what it is intended to accomplish) is unclear. The module that you showed in your example is probably part of a set of modules that make up the entire program. Without seeing all of the code from all of the code from all of the modules, I can't really tell what's going on.
I sort of got, from the tone of your request, that you are really trying to get some basic answers about how C or C++ works and not trying to analyze the inner workings of some complex application. If my hunch is right, I think that you should start by looking at some much simpler code.
Hoppy
Yeah, you're right. But all of the code except for the cout and cin stuff is just plain C. And whether it's C or C++ sort of misses the heart of the matter. The thing that the original poster needs to understand is how to code a function and how to pass variables by reference. Don't you agree?
Hoppy.
I told you that my C is a little rusty. It looks like I should have put a ; after the call to getnumbers() and removed the endl. If you want to make those changes and try it again, it should reduce the number of error messages from the compiler.
I don't have a C compiler on the machine I'm using right now or I'd verify it myself.
My C is a little rusty, so I might not have gotten the syntax exactly right, but this should work.
#include <fstream>
#include <iostream>
/* Note: I don't think you need all of the #includes you had. I think that #include <stdio> would be all you need
*/
using namespace std;
int main()
{
int num1 = 0;
int num2 = 0;
char again = 'y';
while (again=='y')
{
getnumbers(&num1, &num2);
if (findbig(num1, num2) < 0)
{
cout<< num2 " is the larger of " num1 " and " num2 "\n";
} else if (findbig(num1, num2) > 0) {
cout<< num1 " is the larger of " num1 " and " num2 endl "\n";
} else {
cout<< "the numbers are the same.\n";
}
cout<<"Go again?(y/n): ";
cin>>again;
}
}
/*
Notice that getnumbers receives the addresses of two ints from the caller. Before returning, it fill in the values, pointed to by the addresses provided int the input parameters.
*/
void getnumbers(int *num1, int *num2)
{
cout<<"Please enter two numbers to compare "<<endl;
cin>>*num1>>*num2;
}
int getbig(int num1, int num2)
{
/* returns -1 if num1 < num2, 0 if equal, +1 if num1 > num2 */
if (num1 < num2) {
return -1;
} else if (num1 > num2) {
return 1;
} else {
return 0;
}
}
If you need help with some code, it would help a lot if you would post an example of the code you are having problems with. Otherwise, I don't see how anyone can help you!
Hoppy
You are still always going to "cancelmessage:". try the following code:
Do
On Error GoTo cancelmessage
comdia.cancelerror = True
comdia.Filter = "*.doc"
comdia.InitDir = "C:\"
comdia.filename = ""
comdia.ShowSave
GoTo endloop
cancelmessage:
Select Case Err
Case 32755
MsgBox "You must save this document."
Err.Clear
End Select
Loop Until comdia.filename <> ""
endloop:
Err.Clear
You might be confused by the fact that the logic following "cancelmessage:" is executed regardless of whether or not there is an error.
The second time through the loop, you may have gotten an error other than 32755. In this case the "Err.Clear" instruction would not have been executed.
Try putting a "goto endloop" statement after the "comdia.ShowSave" and an "endloop:" statement after the "Loop Until..." statement.
Hoppy
Once again, "ticketsFolder" IS and object and requires a "Set". This distinction in syntax is kind of a stupid rule in VB, but it's something you have to live with.
Hoppy
The problem is that the variable named "subjectLine" is defined as a String. A String is not an Object. When you use the "Set" statement, the compiler expects that the thing you are "Setting" is an object.
Hoppy
Try this.
Dim myDate as Date
Dim mth as String
Dim day as String
Dim yr as String
.
.
.
myDate = CDate(mth & "/" & day & "/" & yr)
I've never encountered anything like that. I would suspect that you have a bad keyboard. If you have a desktop, I'd try borrowing a keyboard from some other computer and see if the problem goes away. I you have a laptop, you might be able to plug in another keyboard and see what happens, but unless you are willing to carry around a spare keyboard, you're probably SOL.
Hoppy
Dear qpido,
From your question, it is not clear what you are looking for. VB is supported in both Excel and in MS Access, although the have different object models. So, are you trying to get data from an en Excel spreadsheet into a listbox in a MS Access Form or vice versa?
By the way, "Me." is like "this->" in C++ or "this." in Java.
EOF is a function that is used with files you have open in Excel. It has nothing to do with the spreadsheet itself.
To do what you want to do, you need to designate a column that tells where the end of the spreadsheet is. It should be a column that has a value for each row of the spreadsheet. Use the IsEmpty function to test the cell in this column in any given row.
Consider the following code:
Dim mySheet as Worksheet
Const COL = 1
Sub main()
Dim i as Integer
Set mySheet = Worksheets("Sheet1")
i = 1
Do While Not IsEmpty(mySheet.cells(i,COL)
.
.
.
Loop
End Sub
Is it possible that you are trying to run IE from an internet shortcut? If so, the web page you bring up comes from the "target" property of the shortcut.
To fix this, right click on the shortcut, click on "Properties" and change the "target" to whatever you want.