SMySQL and @class
SMySQL and @class
- Subject: SMySQL and @class
- From: "baron.s" <email@hidden>
- Date: Wed, 9 Jul 2003 22:02:04 +0200
I want to make an application that allow user to add , modify ...
record to a set of table in a database.
i use SMySQL
i connect fine in a window (multi document cocoa based app)
this window then is closed
all i want to do next is using the SMySQLConnection which have been
created in over part of the app like a window add record to Atable and
use the SMySQLResult with a unique connection established only once.
this is my a part of my code (not to long...)
...
// FrmAddRecord.h
#import <AppKit/AppKit.h>
#import <SMySQL/SMySQL.h>
@interface FrmAddRecord : NSWindowController
{
SMySQLConnection *mySQLConnection;
SMySQLResult *result;
}
- (void)setConnection:(SMySQLConnection *)theConnection;
-(IBAction)buttonaddrecord:(id)sender;
@end
///////////
// FrmAjouter.m
#import "FrmAddRecord.h"
@implementation FrmAjouter
-(id)init
{
self=[super initWithWindowNibName:@"FrmAjouter"];
return self;
}
-(void)windowDidLoad
{
NSLog(@"File loaded");
}
-(IBAction)buttonaddrecord:(id)sender
{
NSArray *names;
[mySQLConnection selectDB:@"testcocoa"];
NSLog(@"AddRecord...");
result = [mySQLConnection queryString:@"select * from customer"];
names = [result fetchFieldsName];
//test part
NSString *name = [names objectAtIndex:1];
NSLog(@"1");
NSLog(name);
NSLog(@"2");
NSString *name2 = [names objectAtIndex:2];
NSLog(name2);
}
- (void)setConnection:(SMySQLConnection *)theConnection;
{
mySQLConnection = theConnection;
}
@end
NSLog name and name2 give nothing
i use @class "FrmAddRecord" in Connect.h and import FrmAddRecord.h in
Connect. and Connect.m
in connect.m i have:
[frmAddRecord setConnection:mySQLConnection];
Nothing append i can use SMySQLResult but it return nothing
How can i do to use the connection which is established in all other
window ???
Can someone help please
Thanks
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.