April 16, 2018 at 12:02 am
Comments posted to this topic are about the item SQL Server From .Net: Making A Connection
April 16, 2018 at 7:30 am
The article isn't available
April 16, 2018 at 8:52 am
Should be working now.
April 16, 2018 at 8:54 am
Working now on this link: http://www.sqlservercentral.com/articles/ADO.NET/168710/
But not the one at the top of this page (https://www.sqlservercentral.com/articles/C%23/168710/)
April 16, 2018 at 9:38 am
Yeah, the escaping the tag sequence for C# is broken. I'll edit the one in the forum
April 16, 2018 at 9:41 am
The link in the daily email worked for me.
April 16, 2018 at 9:54 am
Here is my list of other topics I have thought of for other articles on working with SQL Server in .Net
Data sets and representation of relationships and constraints in .Net code (The first draft of this article is almost ready for submission.)
Data types and what they convert to when you query SQL Server from .Net
Different ways of doing the data conversion
Techniques for converting data for display etc.
Dealing with nulls in data
How to avoid SQL injection in your .Net web app
Connecting LINQ to SQL Server
Dealing with concurrency
Catching data exceptions
Debugging
Working with Schemas in .Net
I am interested in hearing any other ideas, and also the issues that might be helpful for developers (or DBAs) working with SQL Server data in .Net to know about.
April 16, 2018 at 10:11 am
timwell - Monday, April 16, 2018 9:41 AMThe link in the daily email worked for me.
There's a redirect there. I'd probably fixed it by the time you clicked.
April 16, 2018 at 11:04 am
timwell - Monday, April 16, 2018 9:54 AMHere is my list of other topics I have thought of for other articles on working with SQL Server in .NetData sets and representation of relationships and constraints in .Net code (The first draft of this article is almost ready for submission.)
Data types and what they convert to when you query SQL Server from .Net
Different ways of doing the data conversion
Techniques for converting data for display etc.
Dealing with nulls in data
How to avoid SQL injection in your .Net web app
Connecting LINQ to SQL Server
Dealing with concurrency
Catching data exceptions
Debugging
Working with Schemas in .NetI am interested in hearing any other ideas, and also the issues that might be helpful for developers (or DBAs) working with SQL Server data in .Net to know about.
Great info, but when using objects that are disposable, you should use a using statement, so the connection or command are automatically closed and disposed. Alleviates code in the catch block
April 16, 2018 at 2:58 pm
This is a really useful article.
If you are looking for an idea on an article to write. Using Windows forms for multiline user input/output (Adding and editing multi line records) in C# connecting into a stored procedure in MS SQL Server to control the final input to and from the database.
April 16, 2018 at 3:02 pm
louie1487 78804 - Monday, April 16, 2018 11:04 AMtimwell - Monday, April 16, 2018 9:54 AMGreat info, but when using objects that are disposable, you should use a using statement, so the connection or command are automatically closed and disposed. Alleviates code in the catch block
Hello, Thanks, that is a good point. I have not gotten into that habit. Something like this I think? using (SqlConnection conn1 = new SqlConnection(connectString))
{
conn1.Open();
conn1.DoStuffWithTheConnection();
//...
conn1.Close();
}
April 16, 2018 at 5:24 pm
timwell - Monday, April 16, 2018 3:02 PMlouie1487 78804 - Monday, April 16, 2018 11:04 AMtimwell - Monday, April 16, 2018 9:54 AMGreat info, but when using objects that are disposable, you should use a using statement, so the connection or command are automatically closed and disposed. Alleviates code in the catch block
Hello, Thanks, that is a good point. I have not gotten into that habit. Something like this I think?
using (SqlConnection conn1 = new SqlConnection(connectString))
{
conn1.Open();
conn1.DoStuffWithTheConnection();
//...
conn1.Close();
}
Yep
April 17, 2018 at 6:18 am
Thanks for sharing.
I may be wrong but I don't think any of the SqlConnection constructors throws exceptions (cfr https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.sqlconnection(v=vs.110).aspx)
So the try/catch shouldn't be necessary when creating it, only when opening the connection
April 17, 2018 at 7:52 am
Paul_clarke - Monday, April 16, 2018 2:58 PMThis is a really useful article.If you are looking for an idea on an article to write. Using Windows forms for multiline user input/output (Adding and editing multi line records) in C# connecting into a stored procedure in MS SQL Server to control the final input to and from the database.
Thanks for the suggestion. Is that one topic or two, multi-line I/O and connecting using stored procedures? By multiline do you mean like in a DataGrid or just passing multiple rows to and from like with a DataSet?
April 17, 2018 at 8:05 am
thierry.vandurme - Tuesday, April 17, 2018 6:18 AMThanks for sharing.
I may be wrong but I don't think any of the SqlConnection constructors throws exceptions (cfr https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.sqlconnection(v=vs.110).aspx)
So the try/catch shouldn't be necessary when creating it, only when opening the connection
By supplying a really incorrect connection string I was able to cause an ArgumentException exception. That is why I included the try/catch for that.
It's not thrown by the constructor itself but when it's parsing the string.
If your formatting is good enough adding a try/catch for that might be more than necessary.
Viewing 15 posts - 1 through 15 (of 19 total)
You must be logged in to reply to this topic. Login to reply