Click here to Skip to main content
14,423,188 members

Visual Basic

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder12-Jul-09 23:40
cofounderChris Maunder12-Jul-09 23:40 
PinnedHow to get an answer to your question PinPopular
Chris Maunder10-Nov-05 17:30
cofounderChris Maunder10-Nov-05 17:30 
Questionhow to deal with active directory Pin
IbrahimOkasha15-Jan-20 0:24
MemberIbrahimOkasha15-Jan-20 0:24 
AnswerRe: how to deal with active directory Pin
phil.o15-Jan-20 0:53
mvephil.o15-Jan-20 0:53 
Questioncode for calculation of mark for agroup quiz Pin
Member 147079695-Jan-20 21:54
MemberMember 147079695-Jan-20 21:54 
AnswerRe: code for calculation of mark for agroup quiz Pin
OriginalGriff5-Jan-20 21:56
communityengineerOriginalGriff5-Jan-20 21:56 
AnswerRe: code for calculation of mark for agroup quiz Pin
Richard MacCutchan5-Jan-20 23:07
communityengineerRichard MacCutchan5-Jan-20 23:07 
AnswerRe: code for calculation of mark for agroup quiz Pin
Patrice T13-Jan-20 16:32
mvePatrice T13-Jan-20 16:32 
Questionvisual basic 6.0 Pin
Member 1469850023-Dec-19 21:26
MemberMember 1469850023-Dec-19 21:26 
AnswerRe: visual basic 6.0 Pin
Richard MacCutchan23-Dec-19 22:36
communityengineerRichard MacCutchan23-Dec-19 22:36 
AnswerRe: visual basic 6.0 Pin
Dave Kreskowiak25-Dec-19 9:34
mveDave Kreskowiak25-Dec-19 9:34 
QuestionExcel Data Export Pin
Member 1458354220-Dec-19 0:56
MemberMember 1458354220-Dec-19 0:56 
QuestionRe: Excel Data Export Pin
Richard MacCutchan20-Dec-19 1:25
communityengineerRichard MacCutchan20-Dec-19 1:25 
Questionhow to use a variable for sequencer Pin
nrdroque12-Dec-19 5:17
Membernrdroque12-Dec-19 5:17 
AnswerRe: how to use a variable for sequencer Pin
lw@zi 12-Dec-19 6:04
professional lw@zi 12-Dec-19 6:04 
GeneralRe: how to use a variable for sequencer Pin
nrdroque12-Dec-19 6:18
Membernrdroque12-Dec-19 6:18 
QuestionCount duplicates in a large richtextbox (1000+ lines) Pin
VBwolf11-Dec-19 10:23
MemberVBwolf11-Dec-19 10:23 
AnswerRe: Count duplicates in a large richtextbox (1000+ lines) Pin
Dave Kreskowiak11-Dec-19 13:16
mveDave Kreskowiak11-Dec-19 13:16 
QuestionHow can my app look the same on all machines? Pin
Member 146743679-Dec-19 15:17
MemberMember 146743679-Dec-19 15:17 
AnswerRe: How can my app look the same on all machines? Pin
CHill6010-Dec-19 2:46
mveCHill6010-Dec-19 2:46 
AnswerRe: How can my app look the same on all machines? Pin
Dave Kreskowiak10-Dec-19 5:59
mveDave Kreskowiak10-Dec-19 5:59 
AnswerRe: How can my app look the same on all machines? Pin
Gerry Schmitz10-Dec-19 9:14
mveGerry Schmitz10-Dec-19 9:14 
QuestionHow can I get an free installer that registers .dll and .ocx components as I install my app? Pin
Member 146743679-Dec-19 15:17
MemberMember 146743679-Dec-19 15:17 
AnswerRe: How can I get an free installer that registers .dll and .ocx components as I install my app? Pin
CHill6010-Dec-19 2:44
mveCHill6010-Dec-19 2:44 
Question[Solved] - How to retrieve value inserted to variable Pin
nrdroque6-Dec-19 0:26
Membernrdroque6-Dec-19 0:26 
hi every one i have this code to generate a sequential serial number.
and have another private sub to retrive the last inserted serial number
is it possible to do that in this one?


<pre>    Private Sub Gera2d()

        Try
            data = DateAndTime.Now
            Dim con As New SqlConnection
            Dim sql_query As New SqlCommand
            '
            Dim sql_result As SqlDataReader
            '
            con.ConnectionString = "server='" & SqlServer & "';Database=etiquetasKLC;Uid='" & SqlUser & "';PWD='" & Sqlpassword & "';"
            sql_query.Connection = con
            con.Open()
            sql_query.Parameters.Add("@posto", SqlDbType.NVarChar).Value = posto
            sql_query.Parameters.Add("@data", SqlDbType.NVarChar).Value = data
            sql_query.Parameters.Add("@lote", SqlDbType.NVarChar).Value = ordemFabrico
            sql_query.Parameters.Add("@versao", SqlDbType.NVarChar).Value = status
            sql_query.Parameters.Add("@indexnumber", SqlDbType.NVarChar).Value = cavidade + indexnumber
            sql_query.Parameters.Add("@semana", SqlDbType.NVarChar).Value = weekyear
            sql_query.Parameters.Add("@qrgerado", SqlDbType.NVarChar).Value = codigoQr
            sql_query.Parameters.Add("@operador", SqlDbType.NVarChar).Value = op
            sql_query.Parameters.Add("@partnumber", SqlDbType.NVarChar).Value = partnumber
            sql_query.Parameters.Add("posx", SqlDbType.NVarChar).Value = labelx
            sql_query.Parameters.Add("posy", SqlDbType.NVarChar).Value = labely
            sql_query.Parameters.Add("ip_impressora", SqlDbType.NVarChar).Value = enderecoimpressora
            sql_query.CommandText = "INSERT INTO etiquetas with (tablockx)(nome_posto, data, lote, serialnumber,partnumber,versao,indexnumber,semana, qrgerado,operador,snpn,posx,posy,impressora) select top (1) @posto,
            @data,@lote,T.x,@partnumber,@versao, @indexnumber,@semana, T.x+@partnumber+@versao+@indexnumber+@semana, @operador, T.x+@partnumber, @posx,@posy,@ip_impressora
            FROM [etiquetas] x CROSS APPLY (VALUES(format(convert(int,x.serialnumber)+1,'0000000')))T(x) where partnumber like @partnumber  order by id desc ;"

            sql_query.Parameters.AddWithValue("@sn", serialnumber)

            serialnumber = sql_query.ExecuteScalar()

            Try

                If sql_query.ExecuteScalar() <> 0 Then
                    serialnumber = serialnumber
                End If

            Catch ex As Exception
                IO.File.AppendAllText("C:\ti\Log.txt", String.Format("{0}{1}", Environment.NewLine, Now() + " - " + ex.ToString()))

            End Try
            con.Close()
        Catch ex As Exception

            MsgBox(ex.Message)
        End Try
    End Sub


modified 17-Dec-19 11:12am.

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.