gtsrit 0 Newbie Poster

data not save on the strGno, is there is another way to do this?

Dim connetionString As String
Dim strSQL As String
Dim conn As SqlConnection
Dim ds As New DataSet
Dim strGNo As New TextBox

strSQL = " Select * From DocNos Where DocId='" & Trim(Doctype) & "' "
connetionString = "Data Source=sri;Initial Catalog=CMS;User ID=sa;Password=q"

Try
conn = New SqlConnection(connetionString)
conn.Open()
Dim da As New System.Data.SqlClient.SqlDataAdapter(strSQL, conn)

da.Fill(ds, "DocNos")

strGNo.DataBindings.Add("Text", ds, "DocNos.NextNo")
strGNo.DataBindings.Clear()
GetDocNo = Format(strGNo.Text, "000000")

ds.Dispose()
da.Dispose()
conn.Close()

Catch ex As Exception
MsgBox("ToString: " & ex.ToString, MsgBoxStyle.ApplicationModal, "CMS - Cheque")
End Try

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.