c# - Microsoft SQL Server Compact edition insert query return select @@identity -


I am trying to create a function that records a Microsoft SQL Server compact version 3.5 database and returns the ID Returns the newly entered line

This is my code:

  upit = "Join in Crackage (Encarta, Prozed, Lilu, Lide, Dubinarova, D1, D2, Jadidalina, ZPpram, Dubussenja) Price ('Primer 2 Rolaza DWG', 3, 49192.62, 49222.62, 3.11, 74.7693403335958, 15.2495262383346, 14,0,0.00.00.00) "; Public static intecibazoo (string string, string uptipxa) {int id = default (int); SqlCeConnection con = New SqlCeConnection (); Try {string constring = "data source =" + putanja; (Con = new SqlCeConnection (constring)) using {con.Open (); SqlCeTransaction tr = con.BeginTransaction (); SqlCeCommand Com = Null; Com = New SQL Commands (upupsisa, conn); Com.Transaction = tr; Com.ExecuteNonQuery (); Com = New SqlCeCommand (@ "SELECT @@ ID as ID ID", con); Object o = com.ExecuteScalar (); ID = Convert. ToInt32 (O); }} Hold (SqlCeException pre) {message box. Show ("Pahwila to Gahihika:" + East. Message + "/" + Former. NATAR + "/" + Formerly Inner Exception); } Finally {con.Close (); } Return ID; }   

What am I doing wrong ??

SELECT @@ ID as identification with the INSERT statement only The query should be in.

  Crtez (...) INSERT values ​​(...); ID @ SELECT @  as the ID  



Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -