|
If you mean in Query Analyzer, go to Tools/Options and change the settings on the Connection Properties tab. This affects new connections.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi,
I have a program in which I connect to MSSQL database on my system ( local host) I want to connect to a remote database on a system with particular IP. How do I do this?
Karteek
|
|
|
|
|
You don't specify what your program is written in, so I'll assume it is a language that targets the .NET Framework.
You change the connection string property of the SqlCommand object so that the part of the string that reads "Server=(local)", changes the (local), or 127.0.0.1 or whatever to the IP or machine name of the remote server.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Could someone suggest how I might best use my PalmIII w/ my laptop to emulate a network database or databases?
I need a lot of work/ SQL and .NET? (C# and C++/MFC)
Any articles, advice suggestions would be greatly appreciated. thanks
[ps- If it seems like I don't know what I'm talking about, you're right-- I don't.....]
|
|
|
|
|
You can't, simple as that. A PalmIII is only able to connect via a conduit, I believe, and certainly there is no support for SQL databases on the Palm.
Why do you need the network angle ? Just install MSDE or SQL Server on your laptop, the system will be agnostic to where the db comes from anyhow.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
hello I do not have the following problem I can data to my data base add. Only if a data record is present before already in the data base, it functions. That that is appropriate for best ones owing to
void CAdoDatabaseDoc::AddNew()
{
try
{
if (m_ptrRs->Supports(adAddNew))
{
m_piAdoRecordBinding->AddNew(&m_rsRecSet);
strcpy(m_rsRecSet.m_szLastName, " " );
strcpy(m_rsRecSet.m_szFirstName, " " );
strcpy(m_rsRecSet.m_szAge, " " );
m_rsRecSet.m_dtAuswertedatum = (DATE)dtBlank;
m_rsRecSet.m_dtVersuchsdatum = (DATE)dtBlank;
}
}
....
|
|
|
|
|
hi
my problem is now that I get an empty data base entry. How does one make that correct?
thanks
|
|
|
|
|
void CAdoDatabaseDoc::AddNew()
{
try
{
// Kann ein neuer Datensatz hinzugefügt werden?
if (m_ptrRs->Supports(adAddNew))
{
m_ptrRs->AddNew();
m_ptrRs->Update();
//Leeren Datensatz hinzufügen
//m_piAdoRecordBinding->AddNew(&m_rsRecSet);
//COleDateTime dtBlank;
//strcpy(m_rsRecSet.m_szLastName, " " );
//strcpy(m_rsRecSet.m_szFirstName, " " );
//strcpy(m_rsRecSet.m_szAge, " " );
//m_rsRecSet.m_dtAuswertedatum = (DATE)dtBlank;
//m_rsRecSet.m_dtVersuchsdatum = (DATE)dtBlank;
//strcpy(m_rsRecSet.m_szLieblingsfarbe, " " );
//Aktuellen Datensatz aktualisieren
//m_piAdoRecordBinding->Update(&m_rsRecSet);
}
}
// Fehler?
catch (_com_error &e)
{
// Fehlermeldung generieren
GenerateError(e.Error(), e.Description());
}
}
|
|
|
|
|
I have something I want to clarify.
I did a .NET project some time ago and I'm not sure I remember this correctly, but I don't think I called conn.Open() whenever I want to fill a dataset.
I think I read somewhere that calling dataAdapter.Fill() will open the connection and close it right away after it fills the dataset.
If for example I have 100 datasets to fill, would it make a difference if I call conn.Open() before I tried to fill the datasets and then call conn.Close(), or should I leave it to the dataAdapter.Fill() to open and close the connection?
Which one is more efficient? Does it depend on the database server (connection pooling, etc)?
Thanks,
Edbert P.
|
|
|
|
|
EdbertP wrote:
Which one is more efficient?
While I haven't done any testing with this to determine a precise answer, from experience the first connection.Open() has a noticable delay, while subsequent Open() operations have no notiable delay. This is because the connection gets pooled and .NET is pulling the connection out of the pool rather than completely recreating it.
I would say that if timing is absolutely critical that you should Open first, then do all your Fill() operations then Close() because getting and returning a connection to the pool will still take a small amount of time.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
So I suppose that also depends on the database server you're connecting to then?
I'm assuming Access won't have such a luxury...
I'll try to implement Open before doing a whole bunch of sql operations then.
Thanks Colin!
|
|
|
|
|
EdbertP wrote:
I'm assuming Access won't have such a luxury
What luxury? If you are talking about connection pooling it is done on the .NET side - so it works for Access too.
EdbertP wrote:
I'll try to implement Open before doing a whole bunch of sql operations then.
As I said, this is if performance is absolutely critical. And if that is the case then you should also be looking at structuring everything into as few (a single, if possible) database calls. You will get a bigger performance increase over doing a single open and single close if you do that as there is less communication toing and froing between your application and the database.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Hmm...the MSDN article that I read only mentioned ".NET Framework Data Provider for SQL Server provides connection pooling automatically for your ADO.NET client application", so I assumed that it's only for SQL Server.
Thanks for the info
|
|
|
|
|
Hi Everyone,
Since my last post was so lame I thought id better explain this problem I am encountering. On SQL 6.5 doing a search data conversion from unicode to big-5 was fine no problems there. But after upgrading to SQL 2000 and doing a select in Query Analyzer the data comes up as ??? (which i am assuming is ANSII related somehow) Is there a known issue with SQL2000 doing this? Strange that on 6.5 it works fine and only after upgrading has this problem surfaced. Any help on the matter would be greatly appreciated as this is driving me nuts trying to figure out whats going on. Thanks
|
|
|
|
|
hi
I have the following code:
OleDbDataAdapter oleCmd = new OleDbDataAdapter("SELECT [Customer ID], [Customer #], [Company], [Location] FROM [Sheet1$]", oleConn);
DataSet oDS = new DataSet();
oleCmd.Fill(oDS);
The connection string is perfect. no problem with that.
It ran very good until I got this file from the client. though it has the same format and same alignment and same sheet number and etc., myprogram would fail at the FILL dataset line number.
the exception is :
System.oledb.OledbException: No value given for one or more required parameters.
seems to be a bug or something. I really cannot tell.
its erroring out in the thing that in the file they sent the first row is empty.
But, when i delete the first row and execute, program runs fine. again when i do an insert blank row at first, it still runs.
so why it didnt run at first time, and it ran ok second time.?
any format issues with excel ?
( i copied this stuff into a new excel sheet and ran prgm on that and it ran fine on that file)
I just cannot determine what is causing the error and how to resolve it.
can anyone help ?
-messageman
|
|
|
|
|
Using some code I found on MSDN I have been learning how to connect to a MSAccessDB. The code reads like this:
string DbPath = Server.MapPath("shiplist.mdb");<br />
string ConnStr;<br />
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;"+<br />
@"Data Source="+DbPath+";";
Would it not be more elegant to write it as follows:
string ConnStr="Provider=Microsoft.Jet.OLEDB.4.0" + @"Data Source="Server.MapPath("shiplist.mbd")";
Or is there some hidden pitfall that requires that I declare the directory path and DB as a string first as shown in the first example?
Best,
Jerry
I Do Whatever My Rice Krispies Tell Me To.
Toasty0.com
|
|
|
|
|
Toasty0 wrote:
Or is there some hidden pitfall that requires that I declare the directory path and DB as a string first as shown in the first example?
If you declare it in a string first then you can "watch" the value in the debugger more easily, or insert some error checking routing like checking that the file really does exist.
Also, using the + to concatenate strings is really inefficient.
If there was a small number of strings I'd use string.Concat() , or string.Format() . But for a larger number of strings I'd use a StringBuilder .
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Ahem[^]. The C# compiler turns multiple '+' operations in the same statement into a single call to string.Concat anyway.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I want empirical evidence - He just says it is "zippy"
A collegue of mine did some testing last year to determine which was the fastest between +, Concat and a StringBuilder; the + operator lost the race. So, until I see some contrary numbers I still say that the + operator is slower.
Perhaps what is happening is a+b+c+d gets converted into
string.Concat(a, string.Concat(b, string.Concat(c,d)));
As heard in the film Jerry Maguire: Show me the money!
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
This program:
public class ConcatTest
{
public static void Main(string[] args)
{
string x = args[0] + args[1] + args[2] + args[3];
}
} when compiled csc /t:exe ConcatTest.cs produces the following IL (from Reflector[^]):
.method public hidebysig static void Main(string[] args) cil managed
{
.entrypoint
.maxstack 5
.locals (
string text1)
L_0000: ldarg.0
L_0001: ldc.i4.0
L_0002: ldelem.ref
L_0003: ldarg.0
L_0004: ldc.i4.1
L_0005: ldelem.ref
L_0006: ldarg.0
L_0007: ldc.i4.2
L_0008: ldelem.ref
L_0009: ldarg.0
L_000a: ldc.i4.3
L_000b: ldelem.ref
L_000c: call string string::Concat(string, string, string, string)
L_0011: stloc.0
L_0012: ret
} (I was going to post the decompiled C# code but damn me if Reflector doesn't convert it back the other way!)
The four-argument version of Concat can also be examined in Reflector: it calls an internal method FastStringAllocate with the combined lengths of the four strings then makes four calls to the internal method FillStringChecked . If you want to know what's in those, look at the Shared Source CLI[^] - it's supposed to be a slightly cut-down version of the full Framework. Certainly the internal method names are the same!
Now, if you don't know how many strings you want to concatenate, a StringBuilder is probably better (e.g. for building a string in a loop). If you always have a fixed number of strings, Concat may be better. If you're concatenating literal strings, the C# compiler does the concatenation at compile-time.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi,
I'm trying to implement distributed transactions with a MS Access database.
Is that possible ? (and if yes, how ?)
greetz
|
|
|
|
|
|
iam going to develop e-commerce website (shopping basket,catalog,.....) with ASP.NET adn Mysql
i didn't use mysql b4, i developed by sql,access,oracle but not mysql.
so plz if any one know there is problems with this compination plz tell me, i know mysql is stable and nice database but all mysql samples was with php languge, and this is why iam afried to use asp.net with it.
thnx in advance
|
|
|
|
|
hazzem elrefai wrote:
b4
plz
thnx
This is not an SMS text message - you have more that 160 characters to play with. The use of these contractions make the text difficult to read.
Okay, I'll answer your question now.
For an e-commerce application I would ensure you use transactions. From the MySql manual: MySQL Server (version 3.23-max and all versions 4.0 and above) supports transactions with the InnoDB and BDB transactional storage engines.
So you need at least the above version plus, it would appear, one of the transactional plugins. (These may or may not be supplied with MySQL, I don't know)
The other thing that I think is important is Stored Procedures. From the MySQL manual: Stored procedures are implemented in MySQL version 5.0. For the benifits of Stored Procedures click here[^]
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
If you are using framework 1.0 you will need to download the mysql odbc 3.51 driver which you can get from the mysql website. It does already come with 1.1
|
|
|
|