Syntax error (missing operator) in query expression '@ID = @@IDENTITY'

前端 未结 3 772
离开以前
离开以前 2021-01-26 05:57

I have given valuable advise from here

But as subject title says I am receiving error in the btnLogin method, related to my previous question but really the same problem

3条回答
  •  盖世英雄少女心
    2021-01-26 06:52

    If you are thinking of fetching the user id, you have to combine both the statments in to a single batch

     cmd.CommandText = "INSERT INTO LoginLogTable (UserName, LoggedInDate, LoggedInTime) VALUES (@UserName, @LoggedInDate, @LoggedInTime) SELECT @@IDENTITY";
    

提交回复
热议问题