Click here to Skip to main content
15,910,009 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: how to display files that are not in directory? Pin
Luc Pattyn11-Jan-09 15:22
sitebuilderLuc Pattyn11-Jan-09 15:22 
GeneralRe: how to display files that are not in directory? Pin
zaimah11-Jan-09 16:14
zaimah11-Jan-09 16:14 
GeneralRe: how to display files that are not in directory? Pin
Luc Pattyn11-Jan-09 16:45
sitebuilderLuc Pattyn11-Jan-09 16:45 
GeneralRe: how to display files that are not in directory? Pin
zaimah11-Jan-09 17:26
zaimah11-Jan-09 17:26 
GeneralRe: how to display files that are not in directory? Pin
Luc Pattyn11-Jan-09 18:32
sitebuilderLuc Pattyn11-Jan-09 18:32 
GeneralRe: how to display files that are not in directory? Pin
zaimah11-Jan-09 21:14
zaimah11-Jan-09 21:14 
GeneralRe: how to display files that are not in directory? Pin
Luc Pattyn12-Jan-09 2:24
sitebuilderLuc Pattyn12-Jan-09 2:24 
QuestionRetrieve last ID from SQl server Pin
Jodd2-Jan-09 13:15
Jodd2-Jan-09 13:15 
Hallo

I have a function for retrieving the last insertid from Mysql, now I have to change the program for sql server

For Mysql the function is :

Public Shared Function GetLastID() As Integer
Dim ID As Integer
Dim Cmd As New MySql.Data.MySqlClient.MySqlCommand()
Cmd.Connection = Connection
Cmd.CommandText = "SELECT LAST_INSERT_ID()"
Cmd.Connectie.Open()
ID = Cmd.ExecuteScalar
Cmd.Connectie.Close()
Return ID
End Function

For SQL server I have tried :

Public Shared Function GetLastID() As Integer
Dim ID As Integer
Dim Cmd As New System.Data.SqlClient.SqlCommand
Cmd.Connection = Connection
Cmd.CommandText = "SELECT @@IDENTITY"
Cmd.Connectie.Open()
ID = Cmd.ExecuteScalar
Cmd.Connectie.Close()
Return ID
End Function

It works for Mysql, but not for SQL, error : Conversion from type 'DBNull' to type 'Integer' is not valid.

Can anyone help please
AnswerRe: Retrieve last ID from SQl server Pin
Mycroft Holmes2-Jan-09 15:35
professionalMycroft Holmes2-Jan-09 15:35 
AnswerRe: Retrieve last ID from SQl server Pin
N a v a n e e t h2-Jan-09 15:51
N a v a n e e t h2-Jan-09 15:51 
AnswerRe: Retrieve last ID from SQl server Pin
TheComputerMan3-Jan-09 4:44
TheComputerMan3-Jan-09 4:44 
AnswerRe: Retrieve last ID from SQl server Pin
TheComputerMan3-Jan-09 4:49
TheComputerMan3-Jan-09 4:49 
QuestionLost Feature in VB Pin
udatl2-Jan-09 10:57
udatl2-Jan-09 10:57 
AnswerRe: Lost Feature in VB Pin
Fabio V Silva2-Jan-09 12:04
Fabio V Silva2-Jan-09 12:04 
GeneralRe: Lost Feature in VB Pin
udatl2-Jan-09 16:25
udatl2-Jan-09 16:25 
GeneralRe: Lost Feature in VB Pin
TheComputerMan3-Jan-09 4:28
TheComputerMan3-Jan-09 4:28 
QuestionWant to add a comboboxcolumn runtime and pass value to the comboboxcolumn runtime Pin
Nattumakkan2-Jan-09 5:37
Nattumakkan2-Jan-09 5:37 
AnswerRe: Want to add a comboboxcolumn runtime and pass value to the comboboxcolumn runtime Pin
TheComputerMan2-Jan-09 6:46
TheComputerMan2-Jan-09 6:46 
AnswerRe: Want to add a comboboxcolumn runtime and pass value to the comboboxcolumn runtime Pin
dan!sh 2-Jan-09 8:26
professional dan!sh 2-Jan-09 8:26 
QuestionFile in use error Pin
TheComputerMan2-Jan-09 5:04
TheComputerMan2-Jan-09 5:04 
AnswerRe: File in use error Pin
Jon_Boy2-Jan-09 5:11
Jon_Boy2-Jan-09 5:11 
GeneralRe: File in use error Pin
TheComputerMan2-Jan-09 5:21
TheComputerMan2-Jan-09 5:21 
GeneralRe: File in use error Pin
Jon_Boy2-Jan-09 5:30
Jon_Boy2-Jan-09 5:30 
GeneralRe: File in use error Pin
TheComputerMan2-Jan-09 6:24
TheComputerMan2-Jan-09 6:24 
GeneralRe: File in use error Pin
Jon_Boy2-Jan-09 7:04
Jon_Boy2-Jan-09 7:04 

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.