|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Sql 2005 and vb 2005 question?logging the data I need to get the uniqueidentifier to use in vb and pass that information. I am having problems passing the value in vb or when I try to convert both from sql and/or vb to string, still have problem. 'connection string Dim conn As New ADODB.Connection Dim cmd As New ADODB.Command Dim rs As ADODB.Recordset Dim sConnString As String sConnString = "Provider=SQLOLEDB.1;User ID=sa;password=" & password & ";Initial Catalog=" & sDBName & ";Data Source = " & sServer & ";Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096" conn.Open(sConnString) 'record set cmd.ActiveConnection = conn cmd.CommandText = "SELECT sysID, sysName FROM sysMaster WHERE sysName = '" & sComputerName & "'" cmd.CommandType = ADODB.CommandTypeEnum.adCmdText rs = cmd.Execute If rs.EOF Then 'if not found in system Call addComputer() Else 'get id 'sID = rs.Fields("sysID") Call AddEnventory(rs.Fields("sysID")) Call AddDrives(rs.Fields("sysID")) End If rs.Close() conn.Close() Does anybody have any ideas?
Show quote
Hide quote
"Andrew" <And***@discussions.microsoft.com> wrote in message Stop using ADO. In vb2005 you should be using VB.NET and the managed SQL news:44C92856-FC4B-4B71-A9A6-412F3FD8D732@microsoft.com... >I an using a vb2005 app to log data to a sql 2005 server, now when I am > logging the data I need to get the uniqueidentifier to use in vb and pass > that information. I am having problems passing the value in vb or when I > try > to convert both from sql and/or vb to string, still have problem. > > 'connection string > Dim conn As New ADODB.Connection > Dim cmd As New ADODB.Command > Dim rs As ADODB.Recordset > Dim sConnString As String > sConnString = "Provider=SQLOLEDB.1;User ID=sa;password=" & > password & ";Initial Catalog=" & sDBName & ";Data Source = " & sServer & > ";Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096" > conn.Open(sConnString) > 'record set > cmd.ActiveConnection = conn > cmd.CommandText = "SELECT sysID, sysName FROM sysMaster WHERE > sysName = '" & sComputerName & "'" > cmd.CommandType = ADODB.CommandTypeEnum.adCmdText > rs = cmd.Execute > > If rs.EOF Then > 'if not found in system > Call addComputer() > Else > 'get id > 'sID = rs.Fields("sysID") > Call AddEnventory(rs.Fields("sysID")) > Call AddDrives(rs.Fields("sysID")) > End If > > rs.Close() > conn.Close() > > > Does anybody have any ideas? Server provider, System.Data.SqlClient. David
Show quote
Hide quote
"David Browne" <davidbaxterbrowne no potted m***@hotmail.com> wrote in OOPS, should bemessage news:eUPqNGSJHHA.4992@TK2MSFTNGP04.phx.gbl... > > > "Andrew" <And***@discussions.microsoft.com> wrote in message > news:44C92856-FC4B-4B71-A9A6-412F3FD8D732@microsoft.com... >>I an using a vb2005 app to log data to a sql 2005 server, now when I am >> logging the data I need to get the uniqueidentifier to use in vb and pass >> that information. I am having problems passing the value in vb or when I >> try >> to convert both from sql and/or vb to string, still have problem. >> >> 'connection string >> Dim conn As New ADODB.Connection >> Dim cmd As New ADODB.Command >> Dim rs As ADODB.Recordset >> Dim sConnString As String >> sConnString = "Provider=SQLOLEDB.1;User ID=sa;password=" & >> password & ";Initial Catalog=" & sDBName & ";Data Source = " & sServer & >> ";Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096" >> conn.Open(sConnString) >> 'record set >> cmd.ActiveConnection = conn >> cmd.CommandText = "SELECT sysID, sysName FROM sysMaster WHERE >> sysName = '" & sComputerName & "'" >> cmd.CommandType = ADODB.CommandTypeEnum.adCmdText >> rs = cmd.Execute >> >> If rs.EOF Then >> 'if not found in system >> Call addComputer() >> Else >> 'get id >> 'sID = rs.Fields("sysID") >> Call AddEnventory(rs.Fields("sysID")) >> Call AddDrives(rs.Fields("sysID")) >> End If >> >> rs.Close() >> conn.Close() >> >> >> Does anybody have any ideas? > > Stop using ADO. In vb2005 you should be using VB.NET and the managed SQL > Server provider, System.Data.SqlClient. In vb2005 you should be using ADO.NET and the managed SQL Server provider . .. .. David ADO.NET Is there a sample of this on microsofts website?
Show quoteHide quote "David Browne" wrote: > > > "David Browne" <davidbaxterbrowne no potted m***@hotmail.com> wrote in > message news:eUPqNGSJHHA.4992@TK2MSFTNGP04.phx.gbl... > > > > > > "Andrew" <And***@discussions.microsoft.com> wrote in message > > news:44C92856-FC4B-4B71-A9A6-412F3FD8D732@microsoft.com... > >>I an using a vb2005 app to log data to a sql 2005 server, now when I am > >> logging the data I need to get the uniqueidentifier to use in vb and pass > >> that information. I am having problems passing the value in vb or when I > >> try > >> to convert both from sql and/or vb to string, still have problem. > >> > >> 'connection string > >> Dim conn As New ADODB.Connection > >> Dim cmd As New ADODB.Command > >> Dim rs As ADODB.Recordset > >> Dim sConnString As String > >> sConnString = "Provider=SQLOLEDB.1;User ID=sa;password=" & > >> password & ";Initial Catalog=" & sDBName & ";Data Source = " & sServer & > >> ";Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096" > >> conn.Open(sConnString) > >> 'record set > >> cmd.ActiveConnection = conn > >> cmd.CommandText = "SELECT sysID, sysName FROM sysMaster WHERE > >> sysName = '" & sComputerName & "'" > >> cmd.CommandType = ADODB.CommandTypeEnum.adCmdText > >> rs = cmd.Execute > >> > >> If rs.EOF Then > >> 'if not found in system > >> Call addComputer() > >> Else > >> 'get id > >> 'sID = rs.Fields("sysID") > >> Call AddEnventory(rs.Fields("sysID")) > >> Call AddDrives(rs.Fields("sysID")) > >> End If > >> > >> rs.Close() > >> conn.Close() > >> > >> > >> Does anybody have any ideas? > > > > Stop using ADO. In vb2005 you should be using VB.NET and the managed SQL > > Server provider, System.Data.SqlClient. > > OOPS, should be > > In vb2005 you should be using ADO.NET and the managed SQL Server provider . > .. .. > > David > > ADO.NET > > "Andrew" <And***@discussions.microsoft.com> wrote in message Yes.news:A3AD40C0-D1DB-4BAC-A2D2-A3D2E820835C@microsoft.com... > Is there a sample of this on microsofts website? > A Web search for "ado.net sample site:microsoft.com" See: Migrating Code and Concepts from ADO "Classic" to ADO.NET http://msdn2.microsoft.com/en-us/library/ms971478.aspx David I am using the adodb that is in the .net tab of VS 2005. Is that not the same?
Show quoteHide quote "David Browne" wrote: > > > "David Browne" <davidbaxterbrowne no potted m***@hotmail.com> wrote in > message news:eUPqNGSJHHA.4992@TK2MSFTNGP04.phx.gbl... > > > > > > "Andrew" <And***@discussions.microsoft.com> wrote in message > > news:44C92856-FC4B-4B71-A9A6-412F3FD8D732@microsoft.com... > >>I an using a vb2005 app to log data to a sql 2005 server, now when I am > >> logging the data I need to get the uniqueidentifier to use in vb and pass > >> that information. I am having problems passing the value in vb or when I > >> try > >> to convert both from sql and/or vb to string, still have problem. > >> > >> 'connection string > >> Dim conn As New ADODB.Connection > >> Dim cmd As New ADODB.Command > >> Dim rs As ADODB.Recordset > >> Dim sConnString As String > >> sConnString = "Provider=SQLOLEDB.1;User ID=sa;password=" & > >> password & ";Initial Catalog=" & sDBName & ";Data Source = " & sServer & > >> ";Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096" > >> conn.Open(sConnString) > >> 'record set > >> cmd.ActiveConnection = conn > >> cmd.CommandText = "SELECT sysID, sysName FROM sysMaster WHERE > >> sysName = '" & sComputerName & "'" > >> cmd.CommandType = ADODB.CommandTypeEnum.adCmdText > >> rs = cmd.Execute > >> > >> If rs.EOF Then > >> 'if not found in system > >> Call addComputer() > >> Else > >> 'get id > >> 'sID = rs.Fields("sysID") > >> Call AddEnventory(rs.Fields("sysID")) > >> Call AddDrives(rs.Fields("sysID")) > >> End If > >> > >> rs.Close() > >> conn.Close() > >> > >> > >> Does anybody have any ideas? > > > > Stop using ADO. In vb2005 you should be using VB.NET and the managed SQL > > Server provider, System.Data.SqlClient. > > OOPS, should be > > In vb2005 you should be using ADO.NET and the managed SQL Server provider . > .. .. > > David > > ADO.NET > > |
|||||||||||||||||||||||