Hi All
i am try to develop simple module and i want make connection to acess data from the database how can i make the connection
i try this code and it doesnot work
in the meeda.ascx file
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Meeda.ascx.vb"
Inherits="DesktopModules_Meeda_Meeda" %>
<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" Text="Button" /><br />
<br />
in meeda.ascx.vb file
Imports DotNetNuke
Imports System.Web.UI
Imports System.Collections.Generic
Imports System.Reflection
Imports DotNetNuke.Security.PortalSecurity
Imports System.Data.SqlClient
Imports System.Data
Partial Class DesktopModules_Meeda_Meeda
Inherits Entities.Modules.PortalModuleBase
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim re As SqlDataReader
Protected Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
con.ConnectionString = "Server=(local);Database=meeda_try;uid=meeda_try;pwd=meeda_try;"
con.Open()
cmd = con.CreateCommand()
cmd.CommandText = "select UserName from aspnet_Users"
re = cmd.ExecuteReader()
While (re.Read())
Me.txtSearch.Text = re(0).ToString()
'Response.Write(re(0))
End While
con.Close()
End Sub
End Class
i cannot understand if there is an error or to develop module i must write code in a certain way
thanx in advance