|
Matt U. wrote: However, is there a way to pull SQL Server data into Access?
Certainly, I'm not sure of the connection type any more but you could use Access as a front end to a SQL Server database, there is [used to be] a migration wizard. If your current design has 2 MDFs (database and UI) then the change is very simple. If not you may need to refactor some of your Access code.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Use a profiler if you have a problem or if you have time to learn about it.
However don't over optimize.
|
|
|
|
|
I know Luc does not visits Q & A and I really want to learn this thing. I have had brilliant reply from SA but I need more. I am learning greedy. Sorry.
Here[^] is a question of mine if you wich to respond. I totally appreciate if you wish to downvote.
Thanks.
Edit: No disrespect to anyone else who can help me out. I am fan of these guys so I posted this way. Sorry if I offended you.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
modified on Friday, June 17, 2011 4:30 PM
|
|
|
|
|
It's alright. You only want an answer from Luc, so we'll all feel free to ignore this because apparently only SA and Luc know the answer.
|
|
|
|
|
I only post when I want SA to correct me and direct me to his correct post
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You too huh?
|
|
|
|
|
No disrespect to you Sir Pete and others too but I am a fan of these two guys. My fanhood has dominated here. Sorry for that. You have taught me a lot of things and I wish you could help me more. I totally respect anyone who replies to a post with a decent reply but I am totally a fann of these guys. Sorry if this post of mine meant any disrespect of any of you CPians. Really sorry if you sorry if you feel this way Pete.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
I appreciate that you didn't mean anything by it, but there have been some really good new posters coming through the forums recently (letting me take more of a back seat - thanks guys and girls), and a post like this could demotivate them.
|
|
|
|
|
Again, really sorry. It's just the respect I have for them. This does not mean I do not consider anyone else. I know what I owe to this community. I know what I was and what I am. Not just technical things but life as well.
Sorry for anyone who feels I am beyond the limits. Please help people regardless of what they feel and say. That's whta makes CP different from other places guys. We are a community and not a random username on the web.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
So, thrown on the scrapheap; a boy of my tender years.
The best things in life are not things.
|
|
|
|
|
I don't know if ou remember this or not but I had rough time with you and Judah in my initial posts. I really thank you for being gentle after that. I would have ripped off the guy forever if I was you.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
I tend not to remember these things. I've knocked lots of raw posters into being good posters over the years. Apparently I used to help Luc, but I can't remember it (I've posted a heck of a lot of times).
I only remember the really bad ones - the ones who refused to improve.
|
|
|
|
|
Delegats are references type variable in c# which holds references to method at run time,
Two types of delegate Single cast,Multi cast delegates,
Ex:Coffe vending mechaine which holds reference to method at run time about mix of flavour according to user....
|
|
|
|
|
Well, fork me sideways I never knew that. I really need a dripping sarcasm icon.
|
|
|
|
|
d@nish wrote: Luc does not visits Q & A
Nor do I. But I like delegates.
|
|
|
|
|
Hi.
A couple of days ago i had a similar discussion here:
Days ago i had a discussion here:
http://www.codeproject.com/Messages/3923426/Re-Getting-data-from-host-convert-to-string-and-th.aspx[^]
The user called Luc patyn told me to use this code:
using (NetworkStream nStream = new NetworkStream(getSocket(numsock).getSocket(),true)) {<br />
using (FileStream fs = new FileStream("C:\\Users\\Mauri\\Desktop\\" + item.Name, FileMode.Append, FileAccess.Write)) {<br />
using (BinaryWriter writer = new BinaryWriter(fs)) { <br />
for(;;) {<br />
int len=nStream.Read(myReadBuffer, 0, myReadBuffer.Length);<br />
if (len==0) break;<br />
writer.Write(myReadBuffer, 0, len);<br />
}<br />
}<br />
}<br />
}<br />
But my problem is that the socket never returns "0" so it gives a timeout exception:
Unable to write data to the transport connection: An error occurred during connection attempt because the connected part did not properly respond after a period of time, or failed to established connection and connected host has failed to respond.<br />
in this line:
int len = nStream.Read(myReadBuffer, 0, myReadBuffer.Length);
Thanks
|
|
|
|
|
NetworkStream.Read() blocks until data is available, so is pretty much only good for synchronous I/O when you know how many bytes to expect and when. You can use NetworkStream.DataAvailable to check and see if there's data before calling read, but that may not be what you want, in which case you should probably use some asynchronous I/O method.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Are you sure that error is on the reading line? It looks more like a connection problem.
Read will return 0 if the connection is closed normally. If it is closed unexpectedly you can get exceptions trying to call Read.
|
|
|
|
|
I have a small problem with retrieving a DataTable object from an asynchronous call.
My setup:
I have a Winfom app that has a reference to a library.
In the Library I have a class called Run which does:
public static DataTable GetAsyncDataTable(String Query, CommandType sqlCommandType)
{
Abstract.AbstractSqlCommand mySqlCommand = new Concrete.ConcreteSqlCommand();
mySqlCommand.GetAsyncDataTableBegin(Query, sqlCommandType);
queryDuration = mySqlCommand.queryDuration;
return mySqlCommand.MyTable;
}
In the GetAsyncDataTableBegin method the code is
public override IAsyncResult GetAsyncDataTableBegin(String Query, CommandType sqlCommandType)
{
return GetAsyncDataTableBegin(Query, null, sqlCommandType, null);
}
public override IAsyncResult GetAsyncDataTableBegin(String Query, List<SqlParameter> sqlParameters, CommandType sqlCommandType, String ConnectionString)
{
DateTime nu = DateTime.Now;
SqlCommand command = Get(Query, sqlParameters, sqlCommandType, ConnectionString);
return command.BeginExecuteReader(GetAsyncDataTableEnd, command, CommandBehavior.CloseConnection);
}
In the GetAsyncDataTableEnd Method the code is
public override void GetAsyncDataTableEnd(IAsyncResult myResult)
{
SqlCommand command = null;
SqlDataReader dr = null;
DateTime nu = DateTime.Now;
DataTable myTable = new DataTable();
try
{
command = (SqlCommand)myResult.AsyncState;
dr = command.EndExecuteReader(myResult);
myTable.Load(dr);
MyTable = myTable;
}
catch (Exception err)
{
String poef = err.ToString();
}
finally
{
if (null != dr)
dr.Close();
command.Connection.Close();
DateTime klaar = DateTime.Now;
queryDuration = (klaar - nu).Duration();
string Time = queryDuration.ToString();
}
}
And now my problem: When I call the Run.GetAsyncDataTable (first code block), my data is retrieved asynchronously in another thread but the lines in Run.GetAsyncDataTable keep on running so
queryDuration is 0:00:00.000 and mySqlCommand.MyTable = null;
I do not want to poll to wait while mySqlCommand.MyTable == null. How can I have the DataTable filled in the Run.GetAsyncDataTable method?
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
Um ... do you understand what 'asynchronous' means? This is exactly what is supposed to happen; to retrieve the result from an asynchronous call you should provide a callback delegate, which is executed some time later, and in the meantime, your code continues to run. If you want the result to be available 'immediately' on the next line of code, why not use a synchronous query call?
|
|
|
|
|
Hey BobJanova,
I do not want to run an synchronous call to the database because I have sometimes a report running for over more than 1 hour.
Maybe my Run Class should be omitted and my form should use the Abstract/Concrete classes directly
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
If you have a report running for an hour you definitely don't want to be waiting for it to return! Yes, using the asynchronous database classes directly, and passing a callback to be called when the report is complete, might be a better way forward.
|
|
|
|
|
But in which class do I define the delegate?
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
Wherever you're making the database calls (probably in the main form).
|
|
|
|
|
No in the Concrete classes
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|