|
Hello,
I m new to vb.net. I dont know how to connect the Radiobutton with Datasource.
Can anybody help me with example
Regards
Preetha
|
|
|
|
|
.net 2.0 or 1.1?
For basic code behind binding, you need a datareader, or dataset and then set
myRadio.DataSource = myDataSource
myRadio.DataTextField = "TextFieldInSource"
myRadio.DataValueField = "ValueFieldInSource"
myRadio.DataBind()
|
|
|
|
|
|
configuration:
server:
MySql 5.0.15-nt via tcp/ip
Client:
MySql Client Version 5.0.11
Operating system:
XP
Startup Variables:
Max Packet Size 1mb
Net Buffer Length 16k
I am using Inodb and the c/c++ api
Let me know if you need additional config info.
OK.
I have an app which scans documents and then stores them as a blob. The typical size of an image is around 22k.
During storage, the app batches about 100 of these images along with other information in structures in memory and then initiates a transaction and stores all 100, committing when finished.
This works as expected and the time to do this commit is a couple of seconds, anyway, it is fast enough that it is not an issue.
My problem is this:
When I go to retrieve a single image, it can take as long as 60 seconds. I've played around with this quite a lot and when monitoring the network, to see when the image is downloaded, the image appears to come down right away and then the statement hangs/waits for a timeout before returning... as long as 60 seconds.
The statement which hangs is the:
imageRes_set = mysql_store_result(m_mysqlConn);
QStr.Format("select Image from docimages where BatchNum = %s and ItemId = %s and Side = \"%c\"", BatchNum, ItemId, 'F');
mysql_query(m_mysqlConn, LPCSTR(QStr));
int ret = mysql_errno(m_mysqlConn);
if (mysql_errno(m_mysqlConn) != 0) {
str.Format("Error doing Preset Query 51 - %s\nFailure to do Select on Image", mysql_error(m_mysqlConn));
AfxMessageBox(str);
Close_Database_Connection();
return(false);
}
imageRes_set = mysql_store_result(m_mysqlConn);
row = mysql_fetch_row(imageRes_set);
if (row == NULL) {
Mess1.Format("************ The Image, in batch num (%s) does not exist in the Data Base ************\n\n ", BatchNum);
Mess2 = "\tIt is not possible to View and Key an non existing Image\n";
AfxMessageBox (Mess1 + Mess2, MB_OK | MB_APPLMODAL | MB_ICONQUESTION, 0 );
Close_Database_Connection();
return(false);
}
-- modified at 23:19 Tuesday 30th May, 2006
|
|
|
|
|
|
Have you considered mysql_use_result() rather than mysql_store_result() ?
DOCUMENTATION
There are two ways for a client to process result sets. One way is to retrieve the entire result set all at once by calling mysql_store_result(). This function acquires from the server all the rows returned by the query and stores them in the client. The second way is for the client to initiate a row-by-row result set retrieval by calling mysql_use_result(). This function initializes the retrieval, but does not actually get any rows from the server.
In both cases, you access rows by calling mysql_fetch_row(). With mysql_store_result(), mysql_fetch_row() accesses rows that have already been fetched from the server. With mysql_use_result(), mysql_fetch_row() actually retrieves the row from the server. Information about the size of the data in each row is available by calling mysql_fetch_lengths().
After you are done with a result set, call mysql_free_result() to free the memory used for it.
The two retrieval mechanisms are complementary. Client programs should choose the approach that is most appropriate for their requirements. In practice, clients tend to use mysql_store_result() more commonly.
An advantage of mysql_store_result() is that because the rows have all been fetched to the client, you not only can access rows sequentially, you can move back and forth in the result set using mysql_data_seek() or mysql_row_seek() to change the current row position within the result set. You can also find out how many rows there are by calling mysql_num_rows(). On the other hand, the memory requirements for mysql_store_result() may be very high for large result sets and you are more likely to encounter out-of-memory conditions.
An advantage of mysql_use_result() is that the client requires less memory for the result set because it maintains only one row at a time (and because there is less allocation overhead, mysql_use_result() can be faster). Disadvantages are that you must process each row quickly to avoid tying up the server, you don't have random access to rows within the result set (you can only access rows sequentially), and you don't know how many rows are in the result set until you have retrieved them all. Furthermore, you must retrieve all the rows even if you determine in mid-retrieval that you've found the information you were looking for.
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Thanks for the response Eric...
Yes, I have tried both mysql_use_result() and mysql_store_result() with the same outcome, it hangs for about 60 seconds.
I have also checked the rows and fields and when it does return (correctly by the way and with the image) there is exactly 1 field and 1 row as would be expected.
Anything you think I might try or look at?
|
|
|
|
|
Try disabling your virus scanning software.
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Good idea.
I used enditall to close most of the apps on the client side.
I disabled Norton on the client and server side.
Tried again and had the same result... 60 seconds
|
|
|
|
|
You got me on this one.
Could try returning more than one row (just to see how it works - slower, faster, just the same?)...
or, try starting mysql with the --quick switch.
Maybe run your app on a clean OS install.
I'm just grasping at straws - as I'm sure you have done yourself.
Sorry, I can't help.
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Is there something I'm missing on the setup of the server??
Anyone any ideas?
|
|
|
|
|
Hi again
I'm trying to connect to an access db using ADO
i use some sample codes to perform a simple SELECT query and display them through a recordset. I've tryed really hard to make it work i've searched everywhere pls help me find the problem.
This is the code i use::
<br />
<br />
<br />
#include <br />
#include <br />
#include <br />
<br />
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" \<br />
no_namespace rename("EOF", "EndOfFile")<br />
<br />
void main(int argc, char* argv[])<br />
{<br />
<br />
HRESULT hr = S_OK;<br />
_ConnectionPtr m_pConn;<br />
try<br />
{<br />
HRESULT hr = m_pConn.CreateInstance(__uuidof(Connection));<br />
if (FAILED( hr ))<br />
cout<<"Can't create an intance of ADO.Connection"<<endl;<br />
<br />
if (FAILED( m_pConn->Open(_bstr_t("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =ADOTestDB.MDB"),<br />
_bstr_t( "" ),<br />
_bstr_t( "" ), <br />
adModeUnknown )))<br />
<br />
cout<<"Can't open datasource"<<endl;<br />
<br />
<br />
_CommandPtr pCommand;<br />
pCommand.CreateInstance (__uuidof (Command));<br />
pCommand->ActiveConnection = m_pConn; <br />
pCommand->CommandText = "Select Name,Dept From Student";<br />
_RecordsetPtr pRecordset;<br />
pRecordset.CreateInstance (__uuidof (Recordset));<br />
pRecordset->CursorLocation = adUseClient;<br />
pRecordset->Open ( (IDispatch *) pCommand, vtMissing, adOpenStatic,<br />
adLockBatchOptimistic, adCmdUnknown);<br />
<br />
_bstr_t valField1;<br />
int valField2;<br />
pRecordset->MoveFirst();<br />
if (!pRecordset->EndOfFile)<br />
{<br />
while(!pRecordset->EndOfFile)<br />
{<br />
valField1 = pRecordset->Fields->GetItem("Name")->Value;<br />
valField2 = pRecordset->Fields->GetItem("Dept")->Value.intVal;<br />
printf("%d - %s\n",valField2,(LPCSTR)valField1);<br />
pRecordset->MoveNext();<br />
}<br />
}<br />
<br />
<br />
}catch( _com_error &ce )<br />
{<br />
printf("Error:%s\n",ce.Description);<br />
<br />
}<br />
m_pConn->Close();<br />
<br />
}<br />
i get an exeption
"Can't create an intance of ADO.Connection"
and the i asks if i want to debug
Pls help me i'm trying a lot to connect to a db and enything i do seems to be wrong
and the truth is that everytime i post a msg about C++ and ADO no one
replies.
pls i'm desparate
|
|
|
|
|
|
Hello Dear,
Please give me some good ADO Books name.
N.Rajakumar B.E.,
Application Developer,
www.newdreamz.tk
|
|
|
|
|
Hi ppl,
I have installed Server 2005 and when I try to run my application I get the following error mssg:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.
Code:
Imports System.Data
Imports System.Data.SqlClient
Public Conn As SqlConnection = New SqlConnection
Dim da As New SqlDataAdapter
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Conn.ConnectionString = "Data Source=(local);" & _
"Initial Catalog=Rsch1;" & _
"Integrated Security=SSPI"
Conn.Open() ----------> Error Mssg
What could be the problem?
Tnx
|
|
|
|
|
try adding:
Imports System.Data.Sql
“Profanity is the attempt of a lazy and feeble mind to express itself forcefully”
|
|
|
|
|
hi, i need to compare two records of a table, the one with max date and the second highest one...so here need to somehow run a loop and trap the difference of each column and insert this diference in values in a hash table..
i can't get how to do this..could any one plz help me out here
thanx
|
|
|
|
|
deep7 wrote: i can't get how to do this..could any one plz help me out here
What aspect? The getting the rows out of the database? The looping over the columns? What? Since you asked in the SQL forum, I'm gussing that it is the getting stuff out of the database aspect.
To get the two rows in one result set use this:
SELECT TOP 2 *
FROM MyTable
ORDER BY [date] DESC
To get two result sets each with one row use this:
SELECT TOP 1 *
FROM MyTable
ORDER BY [date] DESC;
SELECT TOP 1 *
FROM MyTable
WHERE [date] NOT IN(SELECT MAX([date]) FROM MyTable)
ORDER BY [date] DESC;
Does this help?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Hi, thanks,
but i wanted to know how to compare these two record which i get...its like i have to store the diffrence suppose the 'amount' value is not same, then store this in a hash table...how to compare the two records (I have to check for all columns)
hope u understood..
thanks
|
|
|
|
|
Hi!
This query shows how to do that:
<br />
select e1.EmployeeID, e1.BirthDate, <br />
cast(e1.BirthDate-(<br />
select top 1 e2.BirthDate<br />
from HumanResources.Employee e2<br />
where e2.BirthDate<e1.BirthDate<br />
order by e2.BirthDate desc<br />
) as float)<br />
from HumanResources.Employee e1<br />
order by e1.BirthDate desc<br />
You can try it with SQL Server's AdventureWorks sample DB.
Rainer Stropek
Visit my blog at http://www.cubido.at/Blog/tabid/176/BlogID/4/Default.aspx
|
|
|
|
|
In sql server 2000, i have created tables using enterprise manager, how to convert it to sql stored procedure.
|
|
|
|
|
I think you have some things muddled some where. A table is a set of data made up of rows and columns. A stored procedure is code that you can execute to manipulate or retrieve data.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Did you mean how to get the scripts of created tables?
|
|
|
|
|
yes i wanted the sql script
|
|
|
|
|
In your
Enterprise manager - Tools Menu - Generate sql script or
right click table - All tasks - Generate sql script
|
|
|
|