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.

C# und SQL-Prozeduren

Empfohlene Antworten

Veröffentlicht

Hallo,

Habe mit Wertezuweisung (immer ein bestimmter Wert z.B. 1.75) Probleme.

Anstelle einer funkionierenen Feldzuweisung

Beispiel:

base.DataAdapter.InsertCommand.Parameters.Add("@Länge",SqlDbType.Float,8,"LängeNeu");

möchte ich für das Feld "LängeNeu" den Wert 1.75 verarbeiten.

Hat jemand einen Tipp ??

Danke !

Peschi

  • 1 Monat später...

Ich habe schon öfter was mit C# und SQL Server gemacht, aber deine Frage verstehe ich nicht ganz.

Möchtest du den wert 1.75 in die Spalte schreiben, oder die Länge des Feldes mit 1.75 vorgeben?

Gruß

Screamer

Nachtrag: Ich hab es grad mal ausprobiert. Ergebniss: die 8 die du ja eingetragen hast, bestimmt ja die Länge des Feldes, und das muss eine grade Zahl sein, es kann keine Dezimal zahl sein, falls es dir darum ging ;-)

Das Problem tritt immer dann auf, wenn Float-Werte in die DB geschrieben werden dir binär nicht exakt darzustellen sind. Das Problem kannst du umgehen indem du statt einem float ein decimal übergibst.

Also so:

decimal meinwert = 1.75;

SqlCommand cmd = new SqlCommand("update tabelle1 set spalte1=@wert",conn);

cmd.Parameters.Add("@wert",meinwert);

MfG

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.