Home All Groups Group Topic Archive Search About

UniqueIdentifier Sql Data and Parameters

Author
29 Mar 2006 1:52 AM
den 2005
Hi everybody,

  I have a column in one of tables in one of the sql server that has a data
type of
UniqueIdentifier. Now, I am supplying a value to used this column as filter
to get
specific record.

Note: strCompId is in string datatype.

[code]
adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid", OleDbType.Guid,
Me.strCompId.Length, "COGUID").Value = Me.strCompId

[/code]

The code shown above causes a conversion error.
There is no conversion from string to GUID. Is there?

[code]
adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
OleDbType.VarChar, Me.strCompId.Length, "COGUID").Value = Me.strCompId

[/code]

The code above returns that "@compid" parameter does not exist.

How can I solved this?

Thanks.

den2005
--
MCP Year 2005, Philippines

Author
29 Mar 2006 2:13 AM
Matt Noonan
Well, I hate to sound like I'm not answering the question, but why are you
using the OleDb client in place of SqlClient? You're potentially harming
your application's performance by doing so.

As for @compid not being found, OleDb only uses a '?' placeholder (whether
you gave it a name or not), so if you ask for the parameter by name it's
likely it won't be found.

My advice would be to switch to the SqlClient, where you can name your
parameters and retrieve their values.


--
Matt Noonan
EasyObjects.NET: The O/RM for the Enterprise Library
http://www.easyobjects.net


Show quote
"den 2005" <den2***@discussions.microsoft.com> wrote in message
news:AAFFEB59-8291-488A-AB15-333CD062DD55@microsoft.com...
> Hi everybody,
>
>  I have a column in one of tables in one of the sql server that has a data
> type of
> UniqueIdentifier. Now, I am supplying a value to used this column as
> filter
> to get
> specific record.
>
> Note: strCompId is in string datatype.
>
> [code]
> adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
> OleDbType.Guid,
> Me.strCompId.Length, "COGUID").Value = Me.strCompId
>
> [/code]
>
> The code shown above causes a conversion error.
> There is no conversion from string to GUID. Is there?
>
> [code]
> adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
> OleDbType.VarChar, Me.strCompId.Length, "COGUID").Value = Me.strCompId
>
> [/code]
>
> The code above returns that "@compid" parameter does not exist.
>
> How can I solved this?
>
> Thanks.
>
> den2005
> --
> MCP Year 2005, Philippines
Author
29 Mar 2006 3:15 AM
den 2005
Hi Matt,
   I am using the data for crystal report.

dennis
--
MCP Year 2005, Philippines


Show quote
"Matt Noonan" wrote:

> Well, I hate to sound like I'm not answering the question, but why are you
> using the OleDb client in place of SqlClient? You're potentially harming
> your application's performance by doing so.
>
> As for @compid not being found, OleDb only uses a '?' placeholder (whether
> you gave it a name or not), so if you ask for the parameter by name it's
> likely it won't be found.
>
> My advice would be to switch to the SqlClient, where you can name your
> parameters and retrieve their values.
>
>
> --
> Matt Noonan
> EasyObjects.NET: The O/RM for the Enterprise Library
> http://www.easyobjects.net
>
>
> "den 2005" <den2***@discussions.microsoft.com> wrote in message
> news:AAFFEB59-8291-488A-AB15-333CD062DD55@microsoft.com...
> > Hi everybody,
> >
> >  I have a column in one of tables in one of the sql server that has a data
> > type of
> > UniqueIdentifier. Now, I am supplying a value to used this column as
> > filter
> > to get
> > specific record.
> >
> > Note: strCompId is in string datatype.
> >
> > [code]
> > adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
> > OleDbType.Guid,
> > Me.strCompId.Length, "COGUID").Value = Me.strCompId
> >
> > [/code]
> >
> > The code shown above causes a conversion error.
> > There is no conversion from string to GUID. Is there?
> >
> > [code]
> > adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
> > OleDbType.VarChar, Me.strCompId.Length, "COGUID").Value = Me.strCompId
> >
> > [/code]
> >
> > The code above returns that "@compid" parameter does not exist.
> >
> > How can I solved this?
> >
> > Thanks.
> >
> > den2005
> > --
> > MCP Year 2005, Philippines
>
>
>
Author
29 Mar 2006 4:53 AM
Matt Noonan
Ah, that explains a lot. The last time I used Crystal, I ended up using
typed DataSets to hold the data and binding the report that way.


--
Matt Noonan
EasyObjects.NET: The O/RM for the Enterprise Library
http://www.easyobjects.net


Show quote
"den 2005" <den2***@discussions.microsoft.com> wrote in message
news:7842BDE5-514A-429C-A583-726E259EB87C@microsoft.com...
> Hi Matt,
>   I am using the data for crystal report.
>
> dennis
> --
> MCP Year 2005, Philippines
>
>
> "Matt Noonan" wrote:
>
>> Well, I hate to sound like I'm not answering the question, but why are
>> you
>> using the OleDb client in place of SqlClient? You're potentially harming
>> your application's performance by doing so.
>>
>> As for @compid not being found, OleDb only uses a '?' placeholder
>> (whether
>> you gave it a name or not), so if you ask for the parameter by name it's
>> likely it won't be found.
>>
>> My advice would be to switch to the SqlClient, where you can name your
>> parameters and retrieve their values.
>>
>>
>> --
>> Matt Noonan
>> EasyObjects.NET: The O/RM for the Enterprise Library
>> http://www.easyobjects.net
>>
>>
>> "den 2005" <den2***@discussions.microsoft.com> wrote in message
>> news:AAFFEB59-8291-488A-AB15-333CD062DD55@microsoft.com...
>> > Hi everybody,
>> >
>> >  I have a column in one of tables in one of the sql server that has a
>> > data
>> > type of
>> > UniqueIdentifier. Now, I am supplying a value to used this column as
>> > filter
>> > to get
>> > specific record.
>> >
>> > Note: strCompId is in string datatype.
>> >
>> > [code]
>> > adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
>> > OleDbType.Guid,
>> > Me.strCompId.Length, "COGUID").Value = Me.strCompId
>> >
>> > [/code]
>> >
>> > The code shown above causes a conversion error.
>> > There is no conversion from string to GUID. Is there?
>> >
>> > [code]
>> > adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
>> > OleDbType.VarChar, Me.strCompId.Length, "COGUID").Value = Me.strCompId
>> >
>> > [/code]
>> >
>> > The code above returns that "@compid" parameter does not exist.
>> >
>> > How can I solved this?
>> >
>> > Thanks.
>> >
>> > den2005
>> > --
>> > MCP Year 2005, Philippines
>>
>>
>>
Author
29 Mar 2006 5:45 AM
Cor Ligthert [MVP]
Den,

Yes there is a conversion from string to Guid, it is in the constructor of
the GUID

http://msdn2.microsoft.com/en-us/library/system.guid.guid(VS.80).aspx

The String Guid has to be correct of course, so you have to use the try
catch.

I hope this helps,

Cor

Show quote
"den 2005" <den2***@discussions.microsoft.com> schreef in bericht
news:AAFFEB59-8291-488A-AB15-333CD062DD55@microsoft.com...
> Hi everybody,
>
>  I have a column in one of tables in one of the sql server that has a data
> type of
> UniqueIdentifier. Now, I am supplying a value to used this column as
> filter
> to get
> specific record.
>
> Note: strCompId is in string datatype.
>
> [code]
> adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
> OleDbType.Guid,
> Me.strCompId.Length, "COGUID").Value = Me.strCompId
>
> [/code]
>
> The code shown above causes a conversion error.
> There is no conversion from string to GUID. Is there?
>
> [code]
> adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
> OleDbType.VarChar, Me.strCompId.Length, "COGUID").Value = Me.strCompId
>
> [/code]
>
> The code above returns that "@compid" parameter does not exist.
>
> How can I solved this?
>
> Thanks.
>
> den2005
> --
> MCP Year 2005, Philippines
Author
29 Mar 2006 7:52 AM
den 2005
Thanks, Cor and Matt.
My problem about crystal report does not stopd there.
I am using this Guid as filter to the where clause unfortunately it is not
working.
How do transfer the string value of certain dropdownlsit control to the
crystal report? Start Date and End Date.

This part is first page, the second page I might need to use SubReport,
which I am new with this.

The first part is a summary of the second page.

There is Company Field which displays company name from db1 of table1,
Company ID id DataValue of dropdownlist 'ddlITP'.

Now, Address Field is located on another database of another server. The
link column is COGUID.

both CompanyID and COGUID is in UniqueIdentifier (Sql Data Type)

[code]
Try
            Dim connectString As String = "Provider=SQLOLEDB;data
source=serv1;initial catalog=db1;. . ."

            ''Create and open a connection using the connection string
            Dim adoOleDbConnection As New OleDbConnection(connectString)

            ''Build a SQL statement to query the datasource
            Dim sqlString As String = ""
            sqlString = "Select * From table1"

            ''Retrieve the data using the SQL statement and existing
connection
            Dim adoOleDbDataAdapter As New OleDbDataAdapter(sqlString,
adoOleDbConnection)

            ''Create a instance of a Dataset
            Dim DataSet As New DataSet()

            ''Fill the dataset with the data retrieved.  The name of the table
            ''in the dataset must be the same as the table name in the report.
            adoOleDbDataAdapter.Fill(DataSet, "table1")

            Dim connectString2 As String = "Provider=SQLOLEDB;data
source=serv2;. . ."

            ''Create and open a connection using the connection string
            Dim adoOleDbConnection2 As New OleDbConnection(connectString2)
            'Dim adoSqlConnection As New SqlConnection(connectString)

            ''Build a SQL statement to query the datasource
            Dim sqlString2 As String = ""
            sqlString2 = "Select * From table2 Where COGUID = ?"

            ''Retrieve the data using the SQL statement and existing
connection
            Dim adoOleDbDataAdapter2 As New OleDbDataAdapter(sqlString2,
adoOleDbConnection2)
            'Dim adoSqlDataAdapter As New SqlDataAdapter(sqlString,
adoSqlConnection)
            If Me.strCompId = "" Then
                Me.strCompId = Me.ddlITP.SelectedItem.Value.ToString()
            End If

            'Dim coguid As Guid = DirectCast(Me.strCompId, Guid)
            'Dim coguid As Guid = CType(Me.ddlITP.SelectedItem, Guid)
            Dim coguid As New Guid(Me.strCompId)

            adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@COGUID",
OleDbType.VarChar, Me.strCompId.Length, "COGUID").Value = Me.strCompId

            ''Create a instance of a Dataset
            Dim DataSet2 As New DataSet()

            ''Fill the dataset with the data retrieved.  The name of the table
            ''in the dataset must be the same as the table name in the report.
            adoOleDbDataAdapter2.Fill(DataSet, "table2")

            ''Create an instance of the strongly-typed report object
            Dim crReportDocument As New Report1C()

            ''Pass the populated dataset to the report
            crReportDocument.SetDataSource(DataSet)

            Dim folder As String = System.IO.Directory.GetCurrentDirectory()
            Dim path As String

            path = "c:\inetpub\wwwroot\accountweb\Report1C.rpt"

            If System.IO.File.Exists(path) = True Then

                Dim crConnectionInfo As New ConnectionInfo()
                With crConnectionInfo
                    .ServerName = "serv1"
                    .DatabaseName = "db1"
                    .UserID = "user"
                    .Password = "pass"
                End With
                'With crConnectionInfo
                '    .ServerName = "serv2"
                '    .DatabaseName = "db1"
                '    .UserID = "user"
                '    .Password = "password"
                'End With

                'Get the tables collection from the report object
                Dim crDatabase As Database = crReportDocument.Database
                Dim crTables As Tables = crDatabase.Tables
                Dim crTable As Table
                Dim crTableLogOnInfo As TableLogOnInfo

                'Apply the logon information to each table in the collection
                For Each crTable In crTables
                    crTableLogOnInfo = crTable.LogOnInfo
                    crTableLogOnInfo.ConnectionInfo = crConnectionInfo
                    crTable.ApplyLogOnInfo(crTableLogOnInfo)
                Next

                Me.crvITPReport.ReportSource = crReportDocument


            End If
        Catch exp As Exception


        End Try
[\code]

den2005
--
MCP Year 2005, Philippines


Show quote
"Cor Ligthert [MVP]" wrote:

> Den,
>
> Yes there is a conversion from string to Guid, it is in the constructor of
> the GUID
>
> http://msdn2.microsoft.com/en-us/library/system.guid.guid(VS.80).aspx
>
> The String Guid has to be correct of course, so you have to use the try
> catch.
>
> I hope this helps,
>
> Cor
>
> "den 2005" <den2***@discussions.microsoft.com> schreef in bericht
> news:AAFFEB59-8291-488A-AB15-333CD062DD55@microsoft.com...
> > Hi everybody,
> >
> >  I have a column in one of tables in one of the sql server that has a data
> > type of
> > UniqueIdentifier. Now, I am supplying a value to used this column as
> > filter
> > to get
> > specific record.
> >
> > Note: strCompId is in string datatype.
> >
> > [code]
> > adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
> > OleDbType.Guid,
> > Me.strCompId.Length, "COGUID").Value = Me.strCompId
> >
> > [/code]
> >
> > The code shown above causes a conversion error.
> > There is no conversion from string to GUID. Is there?
> >
> > [code]
> > adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
> > OleDbType.VarChar, Me.strCompId.Length, "COGUID").Value = Me.strCompId
> >
> > [/code]
> >
> > The code above returns that "@compid" parameter does not exist.
> >
> > How can I solved this?
> >
> > Thanks.
> >
> > den2005
> > --
> > MCP Year 2005, Philippines
>
>
>
Author
29 Mar 2006 9:07 AM
Cor Ligthert [MVP]
Matt,

Did you ask this already in the newsgroup.

Microsoft.public.dotnet.languages.vb

In my idea, are Crystal report questions seldom completely answered in these
dotnet newsgroup. However in that newsgroup is somebody who does that the
best.

Not to send you away by the way.

Cor

Show quote
"den 2005" <den2***@discussions.microsoft.com> schreef in bericht
news:2A2C599D-EC4C-48F7-9A7A-982B8C935F37@microsoft.com...
> Thanks, Cor and Matt.
> My problem about crystal report does not stopd there.
> I am using this Guid as filter to the where clause unfortunately it is not
> working.
> How do transfer the string value of certain dropdownlsit control to the
> crystal report? Start Date and End Date.
>
> This part is first page, the second page I might need to use SubReport,
> which I am new with this.
>
> The first part is a summary of the second page.
>
> There is Company Field which displays company name from db1 of table1,
> Company ID id DataValue of dropdownlist 'ddlITP'.
>
> Now, Address Field is located on another database of another server. The
> link column is COGUID.
>
> both CompanyID and COGUID is in UniqueIdentifier (Sql Data Type)
>
> [code]
> Try
>            Dim connectString As String = "Provider=SQLOLEDB;data
> source=serv1;initial catalog=db1;. . ."
>
>            ''Create and open a connection using the connection string
>            Dim adoOleDbConnection As New OleDbConnection(connectString)
>
>            ''Build a SQL statement to query the datasource
>            Dim sqlString As String = ""
>            sqlString = "Select * From table1"
>
>            ''Retrieve the data using the SQL statement and existing
> connection
>            Dim adoOleDbDataAdapter As New OleDbDataAdapter(sqlString,
> adoOleDbConnection)
>
>            ''Create a instance of a Dataset
>            Dim DataSet As New DataSet()
>
>            ''Fill the dataset with the data retrieved.  The name of the
> table
>            ''in the dataset must be the same as the table name in the
> report.
>            adoOleDbDataAdapter.Fill(DataSet, "table1")
>
>            Dim connectString2 As String = "Provider=SQLOLEDB;data
> source=serv2;. . ."
>
>            ''Create and open a connection using the connection string
>            Dim adoOleDbConnection2 As New OleDbConnection(connectString2)
>            'Dim adoSqlConnection As New SqlConnection(connectString)
>
>            ''Build a SQL statement to query the datasource
>            Dim sqlString2 As String = ""
>            sqlString2 = "Select * From table2 Where COGUID = ?"
>
>            ''Retrieve the data using the SQL statement and existing
> connection
>            Dim adoOleDbDataAdapter2 As New OleDbDataAdapter(sqlString2,
> adoOleDbConnection2)
>            'Dim adoSqlDataAdapter As New SqlDataAdapter(sqlString,
> adoSqlConnection)
>            If Me.strCompId = "" Then
>                Me.strCompId = Me.ddlITP.SelectedItem.Value.ToString()
>            End If
>
>            'Dim coguid As Guid = DirectCast(Me.strCompId, Guid)
>            'Dim coguid As Guid = CType(Me.ddlITP.SelectedItem, Guid)
>            Dim coguid As New Guid(Me.strCompId)
>
>            adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@COGUID",
> OleDbType.VarChar, Me.strCompId.Length, "COGUID").Value = Me.strCompId
>
>            ''Create a instance of a Dataset
>            Dim DataSet2 As New DataSet()
>
>            ''Fill the dataset with the data retrieved.  The name of the
> table
>            ''in the dataset must be the same as the table name in the
> report.
>            adoOleDbDataAdapter2.Fill(DataSet, "table2")
>
>            ''Create an instance of the strongly-typed report object
>            Dim crReportDocument As New Report1C()
>
>            ''Pass the populated dataset to the report
>            crReportDocument.SetDataSource(DataSet)
>
>            Dim folder As String =
> System.IO.Directory.GetCurrentDirectory()
>            Dim path As String
>
>            path = "c:\inetpub\wwwroot\accountweb\Report1C.rpt"
>
>            If System.IO.File.Exists(path) = True Then
>
>                Dim crConnectionInfo As New ConnectionInfo()
>                With crConnectionInfo
>                    .ServerName = "serv1"
>                    .DatabaseName = "db1"
>                    .UserID = "user"
>                    .Password = "pass"
>                End With
>                'With crConnectionInfo
>                '    .ServerName = "serv2"
>                '    .DatabaseName = "db1"
>                '    .UserID = "user"
>                '    .Password = "password"
>                'End With
>
>                'Get the tables collection from the report object
>                Dim crDatabase As Database = crReportDocument.Database
>                Dim crTables As Tables = crDatabase.Tables
>                Dim crTable As Table
>                Dim crTableLogOnInfo As TableLogOnInfo
>
>                'Apply the logon information to each table in the
> collection
>                For Each crTable In crTables
>                    crTableLogOnInfo = crTable.LogOnInfo
>                    crTableLogOnInfo.ConnectionInfo = crConnectionInfo
>                    crTable.ApplyLogOnInfo(crTableLogOnInfo)
>                Next
>
>                Me.crvITPReport.ReportSource = crReportDocument
>
>
>            End If
>        Catch exp As Exception
>
>
>        End Try
> [\code]
>
> den2005
> --
> MCP Year 2005, Philippines
>
>
> "Cor Ligthert [MVP]" wrote:
>
>> Den,
>>
>> Yes there is a conversion from string to Guid, it is in the constructor
>> of
>> the GUID
>>
>> http://msdn2.microsoft.com/en-us/library/system.guid.guid(VS.80).aspx
>>
>> The String Guid has to be correct of course, so you have to use the try
>> catch.
>>
>> I hope this helps,
>>
>> Cor
>>
>> "den 2005" <den2***@discussions.microsoft.com> schreef in bericht
>> news:AAFFEB59-8291-488A-AB15-333CD062DD55@microsoft.com...
>> > Hi everybody,
>> >
>> >  I have a column in one of tables in one of the sql server that has a
>> > data
>> > type of
>> > UniqueIdentifier. Now, I am supplying a value to used this column as
>> > filter
>> > to get
>> > specific record.
>> >
>> > Note: strCompId is in string datatype.
>> >
>> > [code]
>> > adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
>> > OleDbType.Guid,
>> > Me.strCompId.Length, "COGUID").Value = Me.strCompId
>> >
>> > [/code]
>> >
>> > The code shown above causes a conversion error.
>> > There is no conversion from string to GUID. Is there?
>> >
>> > [code]
>> > adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
>> > OleDbType.VarChar, Me.strCompId.Length, "COGUID").Value = Me.strCompId
>> >
>> > [/code]
>> >
>> > The code above returns that "@compid" parameter does not exist.
>> >
>> > How can I solved this?
>> >
>> > Thanks.
>> >
>> > den2005
>> > --
>> > MCP Year 2005, Philippines
>>
>>
>>
Author
12 Apr 2006 8:02 AM
den 2005
This problem has been resolved.

den2005
--
MCP Year 2005, Philippines


Show quote
"Cor Ligthert [MVP]" wrote:

> Matt,
>
> Did you ask this already in the newsgroup.
>
> Microsoft.public.dotnet.languages.vb
>
> In my idea, are Crystal report questions seldom completely answered in these
> dotnet newsgroup. However in that newsgroup is somebody who does that the
> best.
>
> Not to send you away by the way.
>
> Cor
>
> "den 2005" <den2***@discussions.microsoft.com> schreef in bericht
> news:2A2C599D-EC4C-48F7-9A7A-982B8C935F37@microsoft.com...
> > Thanks, Cor and Matt.
> > My problem about crystal report does not stopd there.
> > I am using this Guid as filter to the where clause unfortunately it is not
> > working.
> > How do transfer the string value of certain dropdownlsit control to the
> > crystal report? Start Date and End Date.
> >
> > This part is first page, the second page I might need to use SubReport,
> > which I am new with this.
> >
> > The first part is a summary of the second page.
> >
> > There is Company Field which displays company name from db1 of table1,
> > Company ID id DataValue of dropdownlist 'ddlITP'.
> >
> > Now, Address Field is located on another database of another server. The
> > link column is COGUID.
> >
> > both CompanyID and COGUID is in UniqueIdentifier (Sql Data Type)
> >
> > [code]
> > Try
> >            Dim connectString As String = "Provider=SQLOLEDB;data
> > source=serv1;initial catalog=db1;. . ."
> >
> >            ''Create and open a connection using the connection string
> >            Dim adoOleDbConnection As New OleDbConnection(connectString)
> >
> >            ''Build a SQL statement to query the datasource
> >            Dim sqlString As String = ""
> >            sqlString = "Select * From table1"
> >
> >            ''Retrieve the data using the SQL statement and existing
> > connection
> >            Dim adoOleDbDataAdapter As New OleDbDataAdapter(sqlString,
> > adoOleDbConnection)
> >
> >            ''Create a instance of a Dataset
> >            Dim DataSet As New DataSet()
> >
> >            ''Fill the dataset with the data retrieved.  The name of the
> > table
> >            ''in the dataset must be the same as the table name in the
> > report.
> >            adoOleDbDataAdapter.Fill(DataSet, "table1")
> >
> >            Dim connectString2 As String = "Provider=SQLOLEDB;data
> > source=serv2;. . ."
> >
> >            ''Create and open a connection using the connection string
> >            Dim adoOleDbConnection2 As New OleDbConnection(connectString2)
> >            'Dim adoSqlConnection As New SqlConnection(connectString)
> >
> >            ''Build a SQL statement to query the datasource
> >            Dim sqlString2 As String = ""
> >            sqlString2 = "Select * From table2 Where COGUID = ?"
> >
> >            ''Retrieve the data using the SQL statement and existing
> > connection
> >            Dim adoOleDbDataAdapter2 As New OleDbDataAdapter(sqlString2,
> > adoOleDbConnection2)
> >            'Dim adoSqlDataAdapter As New SqlDataAdapter(sqlString,
> > adoSqlConnection)
> >            If Me.strCompId = "" Then
> >                Me.strCompId = Me.ddlITP.SelectedItem.Value.ToString()
> >            End If
> >
> >            'Dim coguid As Guid = DirectCast(Me.strCompId, Guid)
> >            'Dim coguid As Guid = CType(Me.ddlITP.SelectedItem, Guid)
> >            Dim coguid As New Guid(Me.strCompId)
> >
> >            adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@COGUID",
> > OleDbType.VarChar, Me.strCompId.Length, "COGUID").Value = Me.strCompId
> >
> >            ''Create a instance of a Dataset
> >            Dim DataSet2 As New DataSet()
> >
> >            ''Fill the dataset with the data retrieved.  The name of the
> > table
> >            ''in the dataset must be the same as the table name in the
> > report.
> >            adoOleDbDataAdapter2.Fill(DataSet, "table2")
> >
> >            ''Create an instance of the strongly-typed report object
> >            Dim crReportDocument As New Report1C()
> >
> >            ''Pass the populated dataset to the report
> >            crReportDocument.SetDataSource(DataSet)
> >
> >            Dim folder As String =
> > System.IO.Directory.GetCurrentDirectory()
> >            Dim path As String
> >
> >            path = "c:\inetpub\wwwroot\accountweb\Report1C.rpt"
> >
> >            If System.IO.File.Exists(path) = True Then
> >
> >                Dim crConnectionInfo As New ConnectionInfo()
> >                With crConnectionInfo
> >                    .ServerName = "serv1"
> >                    .DatabaseName = "db1"
> >                    .UserID = "user"
> >                    .Password = "pass"
> >                End With
> >                'With crConnectionInfo
> >                '    .ServerName = "serv2"
> >                '    .DatabaseName = "db1"
> >                '    .UserID = "user"
> >                '    .Password = "password"
> >                'End With
> >
> >                'Get the tables collection from the report object
> >                Dim crDatabase As Database = crReportDocument.Database
> >                Dim crTables As Tables = crDatabase.Tables
> >                Dim crTable As Table
> >                Dim crTableLogOnInfo As TableLogOnInfo
> >
> >                'Apply the logon information to each table in the
> > collection
> >                For Each crTable In crTables
> >                    crTableLogOnInfo = crTable.LogOnInfo
> >                    crTableLogOnInfo.ConnectionInfo = crConnectionInfo
> >                    crTable.ApplyLogOnInfo(crTableLogOnInfo)
> >                Next
> >
> >                Me.crvITPReport.ReportSource = crReportDocument
> >
> >
> >            End If
> >        Catch exp As Exception
> >
> >
> >        End Try
> > [\code]
> >
> > den2005
> > --
> > MCP Year 2005, Philippines
> >
> >
> > "Cor Ligthert [MVP]" wrote:
> >
> >> Den,
> >>
> >> Yes there is a conversion from string to Guid, it is in the constructor
> >> of
> >> the GUID
> >>
> >> http://msdn2.microsoft.com/en-us/library/system.guid.guid(VS.80).aspx
> >>
> >> The String Guid has to be correct of course, so you have to use the try
> >> catch.
> >>
> >> I hope this helps,
> >>
> >> Cor
> >>
> >> "den 2005" <den2***@discussions.microsoft.com> schreef in bericht
> >> news:AAFFEB59-8291-488A-AB15-333CD062DD55@microsoft.com...
> >> > Hi everybody,
> >> >
> >> >  I have a column in one of tables in one of the sql server that has a
> >> > data
> >> > type of
> >> > UniqueIdentifier. Now, I am supplying a value to used this column as
> >> > filter
> >> > to get
> >> > specific record.
> >> >
> >> > Note: strCompId is in string datatype.
> >> >
> >> > [code]
> >> > adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
> >> > OleDbType.Guid,
> >> > Me.strCompId.Length, "COGUID").Value = Me.strCompId
> >> >
> >> > [/code]
> >> >
> >> > The code shown above causes a conversion error.
> >> > There is no conversion from string to GUID. Is there?
> >> >
> >> > [code]
> >> > adoOleDbDataAdapter2.SelectCommand.Parameters.Add("@compid",
> >> > OleDbType.VarChar, Me.strCompId.Length, "COGUID").Value = Me.strCompId
> >> >
> >> > [/code]
> >> >
> >> > The code above returns that "@compid" parameter does not exist.
> >> >
> >> > How can I solved this?
> >> >
> >> > Thanks.
> >> >
> >> > den2005
> >> > --
> >> > MCP Year 2005, Philippines
> >>
> >>
> >>
>
>
>

AddThis Social Bookmark Button