|
Yes.
With Int16/32/64 the field is updated automatically.
With byte, it's not.
The DataSet doesn't even allow the byte field to be set to "AutoIncrement = true".
Michal
|
|
|
|
|
Pete, thanks, this seems to be one of the options. Or I can recast the "SQL byte" to "DataSet Int16", set the autoincrement to True in the DataSet and then check programatically whether the autoincremented value in my Windows form is within the boundary of "byte".
Thanks,
Michal
|
|
|
|
|
Hi all,
Iam new to this forumand also to MySQL
I want pass a variable to mysql_query in C. How can I do it?
eg.,
char * sql_insert ;<br />
char * name = "codeproject";<br />
sprintf( sql_insert, "INSERT INTO t1 ( col1 ) VALUES (%s)", name );<br />
<br />
(mysql_query (conn, sql_insert);
If I do this I get segmentation fault?
or how should a variable be passed?
Can anyone help me, please?
Thanks in advance.
|
|
|
|
|
Where does the fault occur?
here -> "sprintf( sql_insert, "INSERT INTO t1 ..."
or
here -> "(mysql_query (conn, sql..."
To me I think the fault should happen at the sprintf call as there is no memory allocated for sprintf to put your string into.
Chris Meech
I am Canadian. [heard in a local bar]
I agree with you that my argument is useless. [Red Stateler]
Hey, I am part of a special bread, we are called smart people [Captain See Sharp]
The zen of the soapbox is hard to attain...[Jörgen Sigvardsson]
I wish I could remember what it was like to only have a short term memory.[David Kentley]
|
|
|
|
|
Thanks.
But how do I do?
How to allocate memory for sprintf?
|
|
|
|
|
We have a query containing some select statements.How the result is returned in DataSet when we call dataAdapter.Fill method.
queries :
----------------------------
SELECT * FROM Table1
SELECT * FROM Table2
SELECT * FROM Table3
----------------------------
|
|
|
|
|
Do all 3 tables have the same fields? If they don't, then it cannot be done.
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
Doesn't it make a seperate table for each select query. What I want is to have all three results in the dataset placed in a seperate table with just one roundtrip to the server. How can I do it ?
|
|
|
|
|
Is there any kind of relationship between the three tables? It would be helpful to provide some specifications of what the three tables are.
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
No relationship exists between them.
|
|
|
|
|
devboycpp wrote: No relationship exists between them.
You are stuck fetching one at a time then. You cannot intermix several different tables into one data set.
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
Hi,
Use a stored procedure. Once you call the stored procedure, you will get result of all three SQL statements, irrespective of any relation between the tables. Use a data adapter to fill a data set. This will create a seperate table for each sql query fired through the stored procedure.
It is as simple as it sounds to be. Hope i am clear enough.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
How can I access those tables. What will their names be ???
dataSet.Tables["Table1"];??? will this work ??
How can I merge the three tables in one table ,assuming they have columns of the same number and datatype but with different names ????
|
|
|
|
|
devboycpp wrote: dataSet.Tables["Table1"];??? will this work ??
You can use -
dataSet.Tables[0] for first table.
dataSet.Tables[1] for the second and so on....
devboycpp wrote: How can I merge the three tables in one table ,assuming they have columns of the same number and datatype but with different names ????
You can use a union clause in the stored procedure instead of merging them in the dataset. I think it would be a better choice !
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
coolestCoder wrote: "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
I have seen that one before and it is a good one. Nice to see it again
|
|
|
|
|
PaulC1972 wrote: have seen that one before and it is a good one. Nice to see it again
Thanks !
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
coolestCoder wrote: Use a stored procedure. Once you call the stored procedure, you will get result of all three SQL statements, irrespective of any relation between the tables. Use a data adapter to fill a data set. This will create a seperate table for each sql query fired through the stored procedure.
It is as simple as it sounds to be.
Cool. I learned something new today Always thought only one table could be in a data set. Makes sense
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
PaulC1972 wrote: Always thought only one table could be in a data set
Why did you think that a DataSet contained a collection of DataTables?
|
|
|
|
|
I forgot that we can have multiple tables in a data set
|
|
|
|
|
i think u can have multiple datatables in one dataset and at the
time of calling dataadapter's fill method u can specify the table name ur filling in dataset.
dataAdapter.Fill(dataset,"table name");
and can access particular table later on from dataset by
dataset.Tables["table name"];
rahul
|
|
|
|
|
Hi Rahul,
Yes, I agree that you can name the data tables while filing the data set. But did you read the question properly ? The requirement was to fill the data tables in only 1 round trip to the data base. And hence only a stored procedure can be used in this scenario ( atleast, i think so ).
And now if you are filling multiple tables using the stored procedure how can you name them ? No hard feelings, but if you know how to name tables generated from SP output, please feel free to reply, so that I can add it to my knowledge.
Thanks !
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
coolestCoder wrote: but if you know how to name tables generated from SP output, please feel free to reply
For this, you have to have your own TableMapping and then supply that mapping object to data adapter.
Something like this:
<br />
DataTableMappingCollection mappings = new DataTableMappingCollection();<br />
mappings.Add("Table", "DescriptiveName");<br />
mappings.Add("Table1", "DescriptiveNameFor2ndTable");<br />
mappings.Add("Table2", "DescriptiveNameFor3rdTable");<br />
<br />
Farhan Noor Qureshi
|
|
|
|
|
how create an ODBC connection? how trancefering data using a network?
madu
|
|
|
|
|
This Google[^] search may help you out. Been a long time since I've dealt with ODBC :->
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
I need to transfer some data from multiple labels on a VB.NET 2005 form to an Access database. I am trying to figure out how to transfer that data from those labels into a row of data and then update the databas and refresh the datagrid to show the new row???
|
|
|
|