RT

解决方案 »

  1.   

    http://www.vbaccelerator.com/home/VB/Code/Controls/ListBar/Visual_Studio_Style_ListBar/article.asp
      

  2.   

    <html><head>
    <style type="text/css">
    .PopupMenu1{
    left:0;
    top:500px;
    width:100px;
    height:20px;
    }
    .moremnenu={
    width:100;
    background:pink;
    visibility:hidden;
    top:50;
    }
    .f
    {
    font-family:Arial;
    font-size:12;
    color=#333333
    }
    </style><script lanuage="javascript">
    function popup()
    {
    popupid.style.visibility="visible";
    popupid.style.left=0;
    popupid.style.top=0;
    }function hide()
    {
    popupid.style.visibility="hidden";
    }function load()
    {
    popupid.style.visibility="hidden";
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    </head><body onload="load()">
    <span class="PopupMenu1" onmouseover="popup()">
    <span style="z-index: -1"><img id="menu" src="csdn.gif" width="99" height="34"></span> 
    </spqn>    
    <div id="popupid" class ="moremnenu" onmouseout="hide()">
    <table border="0" width="100" bordercolor="#ffffff" cellspacing="1" >
      <tr>
        <td bgcolor="#ffcc00" class="f">aaa</td>
      </tr>
      <tr>
        <td bgcolor="#ffcc00" class="f">bbb</td>
      </tr>
      <tr>
        <td bgcolor="#ffcc00" class="f">ccc</td>
      </tr>
      <tr>
        <td bgcolor="#ffcc00" class="f">ddd</td>
      </tr>
      <tr>
        <td bgcolor="#ffcc00" class="f">eee</td>
      </tr>
    </table>
    </div>
    </body></html>
      

  3.   

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            DataSet11.Clear()
            SqlDataAdapter1.SelectCommand.Parameters("@pCity").Value = TextBox1.Text
            SqlDataAdapter1.Fill(DataSet11)
        End Sub
      

  4.   

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            SqlDataAdapter1.Fill(DataSet11)
            Dim dv As New DataView(DataSet11.Tables("customers"))
            Dim s1 As String
            s1 = "City=" & "'" & TextBox1.Text & "'"
            dv.RowFilter = s1
            dv.Sort = "CustomerID Desc"
            DataGrid1.DataSource = dv
        End Sub
      

  5.   

    Dim bm As BindingManagerBase    Dim flag As Integer
        Dim dr As DataRow
        Dim dt As DataTable
        Dim pid As String    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            SqlDataAdapter1.Fill(DataSet11)
            bm = Me.BindingContext(DataSet11, "Employees")
            bm.Position = 0
        End Sub    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            bm.Position = 0
        End Sub    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            bm.Position -= 1
        End Sub    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            bm.Position += 1
        End Sub    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
            bm.Position = bm.Count - 1
        End Sub    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
            TextBox1.Text = ""
            TextBox2.Text = ""
            TextBox3.Text = ""
            Dim ctr, len As Integer
            Dim pid As String
            dt = DataSet11.Tables("Employees")
            len = (dt.Rows.Count - 1)
            dr = dt.Rows(len)
            pid = dr("EmployeeID")
            ctr = CInt(pid) + 1
            TextBox1.Text = ctr
            flag = 1
        End Sub    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
            pid = TextBox1.Text
            flag = 2
        End Sub    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
            pid = TextBox1.Text
            dt = DataSet11.Tables("Employees")
            dr = dt.Rows.Find(pid)
            dr.Delete()
            SqlDataAdapter1.Update(DataSet11, "Employees")
            SqlDataAdapter1.Fill(DataSet11)
            bm.Position = 0
        End Sub    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
            If flag = 1 Then
                dt = DataSet11.Tables("Employees")
                dr = dt.NewRow
                dr(0) = TextBox1.Text
                dr(1) = TextBox2.Text
                dr(2) = TextBox3.Text
                dt.Rows.Add(dr)
            ElseIf flag = 2 Then
                dt = DataSet11.Tables("Employees")
                dr = dt.Rows.Find(pid)
                dr.BeginEdit()
                dr(1) = TextBox2.Text
                dr(2) = TextBox3.Text
                dr.EndEdit()
                TextBox1.Enabled = True
            End If
            flag = 0
            SqlDataAdapter1.Update(DataSet11, "Employees")
            SqlDataAdapter1.Fill(DataSet11)
            bm.Position = 0
        End Sub
    End Class
      

  6.   

    'Dim con As OleDb.OleDbConnection = New OleDb.OleDbConnection("provider=sqloledb;user id=sa;password=;data source=127.0.0.1;initial catalog=northwind")
            'con.Open()
            'Dim com As New OleDb.OleDbCommand("select * from employees", con)
            'Dim dr As OleDb.OleDbDataReader
            'dr = com.ExecuteReader()
            'Do While dr.Read
            'ListBox1.Items.Add(dr.Item("lastname"))
            'Loop
            'dr.Close()
            Dim con As OleDb.OleDbConnection = New OleDb.OleDbConnection("provider=sqloledb;user id=sa;password=;data source=t01;initial catalog=northwind")
            'con.Open()
            Dim com As New OleDb.OleDbCommand("select * from employees")
            Dim com1 As New OleDb.OleDbCommand("select * from customers")
            Dim da As New OleDb.OleDbDataAdapter(com.CommandText, con)
            Dim ds As New DataSet()
            da.Fill(ds, "emp")
            Dim i As Integer = ds.Tables("emp").Rows.Count - 1
            Do While i
                ListBox1.Items.Add(ds.Tables("emp").Rows(i).Item(1))
                i = i - 1
            Loop        da.SelectCommand = com1
            da.Fill(ds, "cust")
      

  7.   

    <%@import Namespace="System.Data"%> <%@import Namespace="System.Data.OleDb"%> <script runat="server" language="c#"> void Page_Load() { String strConnection="Provider=Microsoft.Jet.OleDb.4.0;Data Source="; strConnection+=Server.MapPath("guestbook.mdb"); OleDbConnection objConnection=new OleDbConnection(strConnection); OleDbCommand objCommand1=new OleDbCommand("select * from guestbook",objConnection); objConnection.Open(); dgrdMain.DataSource=objCommand1.ExecuteReader(); dgrdMain.DataBind(); objConnection.Close(); } </script> <html> <body> <asp:DataGrid id="dgrdMain" cellpadding="1" showheader="false" autogeneratecolumns="false" borderwidth="1" runat="server"> <columns> <asp:boundcolumn datafield="ii"/> <asp:TemplateColumn> <itemTemplate> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td><%# DataBinder.Eval(Container,"Dataitem.aa").ToString()%></td> </tr><tr> <td><%# DataBinder.Eval(Container,"Dataitem.bb").ToString()%></td> </tr> </table> </itemTemplate> </asp:TemplateColumn> </columns> </asp:datagrid>