ketao_78(春来江水绿如蓝) 你好﹐可以給個代碼讓我學習一下嗎﹖
比如:
Dim MyData As New SysDataAdmin.SqlDatabaseAdministartor()
DataGrid1.DataSource = MyData.GetDataSet
DataGrid1.DataBind()
這樣可以嗎﹖我測試過不會報錯﹐但沒有數據顯示﹗

解决方案 »

  1.   

    感谢您使用微软产品。ASP.NET可以调用VB.NET编写的DLL文件。
    1,首先编写一个DLL,如下提供一段示例代码:
    Option Explicit
    Option StrictImports SystemNamespace CompVB   Public Class StringComponent      Private StringSet(4) As String      Public Sub New()
             MyBase.New
             StringSet(0) = "VB String 0"
             StringSet(1) = "VB String 1"
             StringSet(2) = "VB String 2"
             StringSet(3) = "VB String 3"
          End Sub      Public Function GetString(ByVal index as Integer) 
             As String
             If ((index < 0) or (index >= Count)) then
                throw new IndexOutOfRangeException
             End If
             GetString = StringSet(index)
          End Function      ReadOnly Property Count() As Long
             Get
                Count = StringSet.Length
             End Get
          End Property   End ClassEnd Namespace
    编译为DLL,并存放在相应Web Application的bin目录下。2,编写ASP.NET文件。如下示例代码:
    <%@ Page Language="C#" Description="ASP.NET Component Test" %>
    <%@ Import Namespace="CompVB"%><html>
    <script language="C#" runat=server>
    void Page_Load(Object sender, EventArgs EvArgs) {
       String Out = "";
       Int32 Count = 0;   // Iterate over component's strings and concatenate.
       Out = Out + "Strings from VB StringComponent<br>";
       CompVB.StringComponent myVBStringComp = new 
       CompVB.StringComponent();
       for (int index = 0; index < myVBStringComp.Count; index++) {
          Out = Out + myVBStringComp.GetString(index) + "<br>";
       }   Message.InnerHtml = Out;
    }
    </script>
    <body>
       <span id="Message" runat=server/>
    </body>
    </html> — 微软全球技术中心 VB支持中心本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
    为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。