|
We have been using ADO.Net with all System.Data.SqlClient classes such as SqlConnection. Things worked fine but lately everything is acting up. One of the senior developers suggested to change the connection string to an Odbc connection string. Now leaving aside why he suggested so, this is my question:
I believe if we change the connection string, we also have to change the source from objects such as SqlConnection to OdbcConnection objects. He says we don't and it should be as simple as changing the connection string. Is this true?
I believe the format of the connection string has to be in the correct format for the classes being used. No?
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
You mean you didn't code to the interfaces?
Try it and see. If the connection object does not throw an exception when you call open with the connection string it will open. Be aware, however, that the difference in connections provides a difference in features and performance.
Need custom software developed? I do C# development and consulting all over the United States.
If you don't ask questions the answers won't stand in your way.
Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.
|
|
|
|
|
I tried it and threw exception. KeyWord driver not supported.
Ennis Ray Lynch, Jr. wrote: You mean you didn't code to the interfaces? Smile
Even if the previous developers coded to interfaces, it will still not work because you still have to create an object of one of the imlementations. For example:
ISomeInterface i = null;
i = new SomeInterfaceImplemenationA(); // here you have to specify the implementation
I guess I was right.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
Looks like you would have to change all of your code to support the new connection string then.
BTW, when coding to interfaces you only use commonly supported features. A good comparison is the signature for IDbDataParameter and SqlParameter. There are some differences that would have caused code change had you not used the interface. Also, I do like to use (overuse) the factory pattern when coding to interfaces.
Need custom software developed? I do C# development and consulting all over the United States.
If you don't ask questions the answers won't stand in your way.
Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.
|
|
|
|
|
AFAIK SqlConnection cannot use ODBC DSN as a connection (never tested though). Also ODBC drivers cannot handle all the functionality that exists in SqlClient namespace (and it's classes) via SqlConnection.
But even if this would be possible, what's the point to add one layer to the connection. When you connect using ODBC, you still connect to the database using a native library. The ODBC is just a layer on top of that.
So if you don't need cross database functionality (which actually requires a much more than just changing a connection type) I just can't see the point.
CodingYoshi wrote: worked fine but lately everything is acting up.
If this means performance problems etc, ODBC certainly isn't a solution.
|
|
|
|
|
Yeah, what he said.
Ask the "senior developer" to prove it.
And stick with the classes in SqlClient.
|
|
|
|
|
Hello,
How to detect white on a string? eg I have a string type address:
41 street FERDINAND Pertusa
The maximum number of line is 11 characters per line, how can we detect the first block: 41 street and 2nd block: FERDINAND Pertusa?
Thank you verry mutch
|
|
|
|
|
abbd wrote: How to detect white on a string
It does not exist. String data has no color attribute.
|
|
|
|
|
led mike wrote: It does not exist. String data has no color attribute.
|
|
|
|
|
I want a button click on my main form to trigger opening a configuration form for user config and then closing it and then automatically starting up a slideshow form to display photos. Below is the event handler for the button click on my main form. I am using the dialogresult of the config window (play slideshow or cancel) to open up the actual slideshow form. I know the slideshow form is running because I can step through the code to initialize it and the program doesn't go back to the main form and just keeps running until I stop debugging but my form10 is not visible. What am I doing wrong?
private void button1_Click(object sender, EventArgs e)
{
Form9 configForm = new Form9();
Int32 timeDelay = Convert.ToInt32(Form9.txtbox.Text);
DialogResult dR = configForm.ShowDialog();
if (dR == DialogResult.OK)
{
Boolean setAsDefault = Form9.setDefault;
Boolean loopSlideshow = Form9.loop;
ArrayList images = libraryManager.getSlideshow(listView1.SelectedItems[0].Tag);
Form10 slideshowForm = new Form10(images,timeDelay,loopSlideshow);
slideshowForm.ShowDialog();
}
}
<i></i>
|
|
|
|
|
Are you sure (dR == DialogResult.OK) ?
Are you seting DialogResult = DialogResult.OK in Form9 ?
Calin
|
|
|
|
|
Yes, it is being set. And I am able to break on that part of the code..
|
|
|
|
|
I had the code to play the slideshow inside the form_load function which never let's the form actually load.duh. so now before it loads i initialize the picturebox image to the first item in the array list of images in my slideshow. now I have the slideshow starting on a click of the play button in my new form. and doing:
private void buttonplay_click(sender, e)
{
foreach(image x in arraylist)
{
picturebox1.image = (image)x;
thread.sleep(3000);
}
}
while it's loads, i see the original image. once i click play the form goes white and shows no more images. :S
|
|
|
|
|
doing a Thread.Sleep(...) in your GUI thread is going to hang up your GUI. try using a Timer that fires every 3000 milli-seconds to go to the next image
|
|
|
|
|
Hi,
I would like to excute a command after a certain period of time, for instance 1 sec.
For Example:
pictureBox78.Location = new System.Drawing.Point(460, 360);
1 sec interval
pictureBox78.Location = new System.Drawing.Point(560, 360);
1 sec interval
pictureBox78.Location = new System.Drawing.Point(660, 360);
1 sec interval
pictureBox78.Location = new System.Drawing.Point(760, 360);
and so on...
Thanks in Advance
|
|
|
|
|
OK, so what's stopping you from dropping a Timer on the form and handling it's Tick event?? In your Tick handler code, just look at the current Location.X parameter and add 100 to it.
|
|
|
|
|
I should have mentioned the fact that the picturebox may change and it does not necessarily change it's x coordinate by a constant value. It may also changes its y value.
|
|
|
|
|
then how does it change? what decides which value changes if any?
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
bar3000 wrote: and it does not necessarily change it's x coordinate by a constant value. It may also changes its y value.
So?? The concept is still the same. You're just chaning the math that you have to do inside the Tick event.
|
|
|
|
|
I'd use a System.Timers.Timer , but that's just me.
|
|
|
|
|
Intresting, but I'd be delighted if you could give me some more detailed code because I am a real noob in C#. Thank you
|
|
|
|
|
bar3000 wrote: I am a real noob in C#.
And as such, I would be doing you a disservice if I provided you with code; read the documentation and experiment, you'll learn more.
|
|
|
|
|
I would definitely use a Windows.Forms.Timer since that one ticks on the GUI thread, hence the tick handler can manipulate all Controls directly without needing any Invoke stuff.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:20 AM
|
|
|
|
|
Yeah, but since he's so new at this, I didn't want to throw the control cross-threading problem into his already existant confusion.
|
|
|
|
|
I would. (Where's the evil grin emoticon?)
|
|
|
|