Click here to Skip to main content
15,894,180 members
Home / Discussions / C#
   

C#

 
GeneralRe: issue with Date Format in SSRS Pin
Saksida Bojan21-Dec-09 23:39
Saksida Bojan21-Dec-09 23:39 
GeneralRe: issue with Date Format in SSRS Pin
Blue_Boy21-Dec-09 23:54
Blue_Boy21-Dec-09 23:54 
QuestionC# Data link to another PC? Pin
miss YY21-Dec-09 22:20
miss YY21-Dec-09 22:20 
AnswerRe: C# Data link to another PC? Pin
Calla21-Dec-09 22:30
Calla21-Dec-09 22:30 
AnswerRe: C# Data link to another PC? Pin
The Man from U.N.C.L.E.21-Dec-09 22:38
The Man from U.N.C.L.E.21-Dec-09 22:38 
AnswerRe: C# Data link to another PC? Pin
rag_Singh21-Dec-09 22:57
rag_Singh21-Dec-09 22:57 
AnswerRe: C# Data link to another PC? Pin
Md. Marufuzzaman22-Dec-09 10:36
professionalMd. Marufuzzaman22-Dec-09 10:36 
AnswerRe: C# Data link to another PC? [modified] Pin
hamed-vojdani24-Dec-09 7:13
hamed-vojdani24-Dec-09 7:13 
My offer ,else use MSDASC class


now see what is my offer..

1- Server side:
Run Sql Server browser Service in your database server machine, then
create Valid login for your database,set sql server authentication to Windows and SQL athentication
2- Application side:
with a form like this:
http://privateimage.com/images/9fq89vuk7uokjz8koz.jpg

and with functions like below for buttons
private void btnSearch_Click(object sender, EventArgs e)
{
    SqlDataSourceEnumerator SqlEnumerator = SqlDataSourceEnumerator.Instance;
    DataTable dt = new DataTable();
    dt = SqlEnumerator.GetDataSources();
    dataGridView1.DataSource = dt.DefaultView;
}


private void btnSave_Click(object sender, EventArgs e)
{
    if (dataGridView1.SelectedRows.Count != 0)
    {
        string ConString = "";

        SqlConnectionStringBuilder builder =new SqlConnectionStringBuilder();
        builder.ApplicationName = "MyApp";
        builder.WorkstationID = Environment.MachineName;
        builder.UserID = txtLoginName.Text.Trim();
        builder.Password = txtPassword.Text.Trim());
        builder.InitialCatalog="MyDBName";
        builder.DataSource = dataGridView1.SelectedRows[0].Cells["ServerName"].Value.ToString()+
       "\\"+dataGridView1.SelectedRows[0].Cells["InstanceName"].Value.ToString();

        ConString = builder.ConnectionString;

    }

}


at the end your data link string is ConString variable, you can store it in encrypted file or registry. each time application start check stored connection, and if failed retry this form

note: used namespace are:
using System.Data.Sql;
using System.Data.SqlClient;

hope helps with ugly sample Wink | ;)

modified on Friday, December 25, 2009 9:45 AM

QuestionBeginner Question: Data Binding Controls in C# WinForms Pin
Jyncus21-Dec-09 21:50
Jyncus21-Dec-09 21:50 
QuestionSSRS Date format help required Pin
siddisagar21-Dec-09 18:03
siddisagar21-Dec-09 18:03 
AnswerRe: SSRS Date format help required Pin
Saksida Bojan21-Dec-09 19:29
Saksida Bojan21-Dec-09 19:29 
QuestionSqlite + TEXT Pin
Ryan Minor21-Dec-09 11:06
Ryan Minor21-Dec-09 11:06 
AnswerRe: Sqlite + TEXT Pin
S. Brozius21-Dec-09 11:40
S. Brozius21-Dec-09 11:40 
QuestionScroll bar apperance Pin
viciouskinid21-Dec-09 10:58
viciouskinid21-Dec-09 10:58 
AnswerRe: Scroll bar apperance Pin
Luc Pattyn21-Dec-09 11:27
sitebuilderLuc Pattyn21-Dec-09 11:27 
GeneralRe: Scroll bar apperance Pin
viciouskinid21-Dec-09 11:32
viciouskinid21-Dec-09 11:32 
QuestionVB to C# conversion. Implements Pin
aalex67521-Dec-09 5:56
aalex67521-Dec-09 5:56 
AnswerRe: VB to C# conversion. Implements Pin
Ian Shlasko21-Dec-09 6:17
Ian Shlasko21-Dec-09 6:17 
QuestionHow is the algorithm to compare a "lot" of strings, tell z frequency and tell which similar strings are found in which index? Pin
CoderForEver21-Dec-09 5:39
CoderForEver21-Dec-09 5:39 
AnswerRe: How is the algorithm to compare a "lot" of strings, tell z frequency and tell which similar strings are found in which index? Pin
Richard MacCutchan21-Dec-09 6:04
mveRichard MacCutchan21-Dec-09 6:04 
GeneralRe: How is the algorithm to compare a "lot" of strings, tell z frequency and tell which similar strings are found in which index? Pin
CoderForEver21-Dec-09 6:43
CoderForEver21-Dec-09 6:43 
GeneralRe: How is the algorithm to compare a "lot" of strings, tell z frequency and tell which similar strings are found in which index? Pin
Richard MacCutchan21-Dec-09 6:51
mveRichard MacCutchan21-Dec-09 6:51 
GeneralRe: How is the algorithm to compare a "lot" of strings, tell z frequency and tell which similar strings are found in which index? Pin
CoderForEver21-Dec-09 6:57
CoderForEver21-Dec-09 6:57 
GeneralRe: How is the algorithm to compare a "lot" of strings, tell z frequency and tell which similar strings are found in which index? Pin
Richard MacCutchan21-Dec-09 9:03
mveRichard MacCutchan21-Dec-09 9:03 
AnswerRe: How is the algorithm to compare a "lot" of strings, tell z frequency and tell which similar strings are found in which index? Pin
Alan Balkany21-Dec-09 9:55
Alan Balkany21-Dec-09 9:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.