Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Guten Morgen,

ich möchte mich jetzt speziell mit der Anbindung von Datenbanken beschäftigen, nur gibt es bereits bei der Verbindung Probleme :).

Ich vermute das Problem liegt im Connection-String. Denn wenn ich das Programm debugge, hat die DataSource-Eigenschaft des SqlConnectionStringBuilders folgenden Wert:

"\\\\Server\\Instanz"

Hier ein Auszug aus meinem Code


 string sFirstName = "";

            string sLastName = "";


            Console.WriteLine("Vorname: ");

            sFirstName = Convert.ToString(Console.ReadLine());


            Console.WriteLine("Nachname: ");

            sLastName = Convert.ToString(Console.ReadLine());


            SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();

            builder.DataSource = @"\\Server\Instanzname";

            builder.InitialCatalog = "AdventureWorksDW";

            builder.IntegratedSecurity = true;


            /*

            SqlConnection con = new SqlConnection(@"Data Source= \\Server\Instanz;" +

                                       "Initial Catalog=AdventureWorksDW;" +

                                       "Integrated Security=sspi");

             */


            SqlConnection con = new SqlConnection(builder.ConnectionString);



            string strSQL = "SELECT * FROM DimCustomer " +

                            "WHERE FirstName = @FirstName OR " +

                                   "LastName = @LastName";

            SqlCommand cmd = new SqlCommand(strSQL, con);


            cmd.Parameters.AddWithValue("@FirstName", sFirstName);

            cmd.Parameters.AddWithValue("@LastName", sLastName);

            try

            {

                con.Open();

                SqlDataReader rd = cmd.ExecuteReader();

                while (rd.Read())

                    Console.WriteLine("{0,-5}{1,-35}",

                               rd["FirstName"], rd["LastName"]);

                rd.Close();

                con.Close();



            }

            catch (Exception e)

            {

                Console.WriteLine(e);

            }

            Console.Read();

Gruß

Jan

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.