Click here to Skip to main content
15,913,239 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionselected index changed in listbox control Pin
shabonaa17-Apr-07 9:29
shabonaa17-Apr-07 9:29 
AnswerRe: selected index changed in listbox control Pin
kubben17-Apr-07 14:07
kubben17-Apr-07 14:07 
GeneralRe: selected index changed in listbox control Pin
shabonaa18-Apr-07 6:49
shabonaa18-Apr-07 6:49 
GeneralRe: selected index changed in listbox control Pin
kubben18-Apr-07 7:23
kubben18-Apr-07 7:23 
GeneralRe: selected index changed in listbox control Pin
shabonaa18-Apr-07 8:44
shabonaa18-Apr-07 8:44 
QuestionWizard Control Question Pin
Brent Lamborn17-Apr-07 9:16
Brent Lamborn17-Apr-07 9:16 
AnswerRe: Wizard Control Question Pin
Brent Lamborn17-Apr-07 9:48
Brent Lamborn17-Apr-07 9:48 
QuestionConnectionString Pin
musigati17-Apr-07 9:03
musigati17-Apr-07 9:03 
I am new to ASP.NET
I am working on something as example but get a connectionstring not initialize problem and can't solve it.
Any help?

Thanks

This is all the files i have web config file, default.aspx ,default.aspx.vb and class.vb

Web.Conf
*********



<configuration>
<connectionstrings>
<add name="ConnectionString" connectionstring="Dsn=Photobank;uid=adminphotobank;pwd=adminphotobank"
="" providername="System.Data.Odbc">

<appsettings>
<add key="photobankConnectionString" value="packet size=4096;user id=bank;data source=ODBC.SQL.photo;persist security info=False;initial catalog=bank;password=bank">



<system.web>

<compilation debug="true" strict="false" explicit="true">
<pages>
<namespaces>
<clear>
<add namespace="System">
<add namespace="System.Collections">
<add namespace="System.Collections.Specialized">
<add namespace="System.Configuration">
<add namespace="System.Text">
<add namespace="System.Text.RegularExpressions">
<add namespace="System.Web">
<add namespace="System.Web.Caching">
<add namespace="System.Web.SessionState">
<add namespace="System.Web.Security">
<add namespace="System.Web.Profile">
<add namespace="System.Web.UI">
<add namespace="System.Web.UI.WebControls">
<add namespace="System.Web.UI.WebControls.WebParts">
<add namespace="System.Web.UI.HtmlControls">



<authentication mode="Windows">




******************************************
default.aspx.vb


Imports System.IO
Imports System.IO.Path
Imports System.Web.UI.Page
Imports System.Data.DataSet
Imports System.Data.DataTable
Imports System.Data.SqlClient


Partial Class _Default
Inherits System.Web.UI.Page

#Region " Code généré par le Concepteur Web Form "

'Cet appel est requis par le Concepteur Web Form.
'<system.diagnostics.debuggerstepthrough()>
Private Sub InitializeComponent()
Me.oConn = New System.Data.SqlClient.SqlConnection

End Sub
Protected WithEvents cmdAdvancedSearch As System.Web.UI.WebControls.Button
Protected WithEvents oConn As SqlConnection
Protected WithEvents Button1 As System.Web.UI.WebControls.Button


'REMARQUE : la déclaration d'espace réservé suivante est requise par le Concepteur Web Form.
'Ne pas supprimer ou déplacer.

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN : cet appel de méthode est requis par le Concepteur Web Form
'Ne le modifiez pas en utilisant l'éditeur de code.

InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Placez ici le code utilisateur pour initialiser la page

If Not IsPostBack Then
ViewState("isQuickSearch") = True

FillddList("ddCategory")
End If


End Sub



Public Function FillddList(ByVal ddList As String)
Dim SQLQuery As String 'SQL to fetch Data
Dim FieldText, FieldValue As String 'Name of the columns to add as text and as values...
Dim HeaderItem As New ListItem
Dim SelectAllItem As New ListItem
SQLQuery = ""
FieldText = ""
FieldValue = ""

Select Case ddList
Case "ddCategory"

SQLQuery = "SELECT * FROM CATEGORY ORDER BY " & "DESC E"
FieldText = "DESC E"
FieldValue = "DESC E"

HeaderItem.Value = ""
HeaderItem.Text = "Select a category"

SelectAllItem.Value = ""
SelectAllItem.Text = "All categories"

End Select

Dim Data As SqlDataAdapter = New SqlDataAdapter(SQLQuery, oConn)
Dim Odata As New Data.DataSet()
Data.Fill(Odata) // MY ERROR IS ON THIS LINE: CONNECTION STRING NOT INITIALIZE


Dim xrd As DropDownList = CType(Me.FindControl(ddList), DropDownList)
xrd.DataSource = Odata

xrd.DataTextField = Odata.Tables.Item(0).Columns(FieldText).ToString
xrd.DataValueField = Odata.Tables.Item(0).Columns(FieldValue).ToString

xrd.DataBind()

If SelectAllItem.Text <> "" Then
xrd.Items.Insert(0, SelectAllItem)
End If

If HeaderItem.Text <> "" Then
xrd.Items.Insert(0, HeaderItem)
End If

End Function

End Class

************************************************

default.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>





<title>Untitled Page




This is a test



<asp:dropdownlist id="DropDownList1" runat="server" datasourceid="SqlDataSource1"
="" datatextfield="CTGY ID" datavaluefield="DESC E">
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:ConnectionString %>"
="" providername="<%$ ConnectionStrings:ConnectionString.ProviderName %>" selectcommand="SELECT * FROM [ CATEGORY]">







*****************************************

Thanks,

Musigati
AnswerRe: ConnectionString Pin
Sandeep Akhare19-Apr-07 1:56
Sandeep Akhare19-Apr-07 1:56 
GeneralRe: ConnectionString Pin
musigati19-Apr-07 3:01
musigati19-Apr-07 3:01 
QuestionNumber of lines in a label control Pin
happyheartcs17-Apr-07 8:47
happyheartcs17-Apr-07 8:47 
AnswerRe: Number of lines in a label control Pin
kubben17-Apr-07 14:09
kubben17-Apr-07 14:09 
QuestionIIS6 App Mapping problem with .* file extension Pin
TOMCAT8117-Apr-07 6:24
TOMCAT8117-Apr-07 6:24 
AnswerRe: IIS6 App Mapping problem with .* file extension Pin
N a v a n e e t h17-Apr-07 18:26
N a v a n e e t h17-Apr-07 18:26 
GeneralRe: IIS6 App Mapping problem with .* file extension Pin
TOMCAT8117-Apr-07 19:18
TOMCAT8117-Apr-07 19:18 
QuestionAdvice needed... Pin
Software_Specialist17-Apr-07 5:41
Software_Specialist17-Apr-07 5:41 
AnswerRe: Advice needed... Pin
Tarakeshwar Reddy17-Apr-07 5:52
professionalTarakeshwar Reddy17-Apr-07 5:52 
AnswerRe: Advice needed... Pin
kinsella_john17-Apr-07 17:22
kinsella_john17-Apr-07 17:22 
AnswerRe: Advice needed... Pin
Russell Jones17-Apr-07 23:33
Russell Jones17-Apr-07 23:33 
QuestionHow to get toolbar button's coordinates Pin
aamn117-Apr-07 5:35
aamn117-Apr-07 5:35 
AnswerRe: How to get toolbar button's coordinates Pin
Sandeep Akhare19-Apr-07 2:01
Sandeep Akhare19-Apr-07 2:01 
Questiondynamic styles Pin
kkadir17-Apr-07 5:33
kkadir17-Apr-07 5:33 
AnswerRe: dynamic styles Pin
mghiassi17-Apr-07 7:28
mghiassi17-Apr-07 7:28 
AnswerRe: dynamic styles Pin
kinsella_john17-Apr-07 17:33
kinsella_john17-Apr-07 17:33 
GeneralRe: dynamic styles Pin
kkadir17-Apr-07 22:03
kkadir17-Apr-07 22:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.