Click here to Skip to main content
15,887,875 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: problem in SELECT statement Pin
Not Active11-Jul-07 20:06
mentorNot Active11-Jul-07 20:06 
Questiondatetimepicker control asp.net Pin
moomoooomoo11-Jul-07 17:57
moomoooomoo11-Jul-07 17:57 
AnswerRe: datetimepicker control asp.net Pin
Sathesh Sakthivel11-Jul-07 17:59
Sathesh Sakthivel11-Jul-07 17:59 
Questiongridview updating Pin
jeguzmanv11-Jul-07 17:41
jeguzmanv11-Jul-07 17:41 
AnswerRe: gridview updating Pin
Imran Khan Pathan11-Jul-07 18:35
Imran Khan Pathan11-Jul-07 18:35 
Questiongetting cell value on datagrid [modified] Pin
firestoper11-Jul-07 16:31
firestoper11-Jul-07 16:31 
AnswerRe: getting cell value on datagrid Pin
Imran Khan Pathan11-Jul-07 18:40
Imran Khan Pathan11-Jul-07 18:40 
QuestionObject reference not set to an instance of an object Pin
ASPnoob11-Jul-07 15:47
ASPnoob11-Jul-07 15:47 
Hi I tried to use an if statement to determine when myCon is null when no item of ListBox2 is selected like the following.
    <br />
      Dim i As Integer<br />
      Dim myCon As OdbcConnection<br />
      Dim cmd as OdbcCommand<br />
      myCon = New OdbcConnection("Driver={MySQL ODBC 3.51Driver}; Server=myServer;Database=myDB;User=myUserassword=myPass;Option=3;")<br />
<br />
      For i = 0 To ListBox2.Items.Count - 1<br />
      If ListBox2.Items(i).Selected Then<br />
<br />
      cmd = New OdbcCommand("SELECT * FROM myTable where Professions = '"& ListBox2.Items(i).Text &"' ")<br />
End If<br />
Next<br />
If Not IsNothing(myCon) then <br />
  myCon.Open()<br />
<br />
  cmd.Connection = myCon<br />
<br />
  Dim ds As New DataSet<br />
<br />
  Dim ad As New OdbcDataAdapter(cmd)<br />
<br />
  ad.Fill(ds)<br />
<br />
  Me.ListBox2.DataSource = ds<br />
<br />
  Me.ListBox2.DataTextField = "Professions"<br />
<br />
  Me.ListBox2.DataBind()<br />
End IF<br />


When viewed in the browser I get the exception "Object reference not set to an instance of an object". I have read that the most common causes of this exception are not declaring the variables before using them, bad scoping, and not using the key word New when instantiating. I thought I have made sure that the afore mentioned causes are not the causes of the error I'm getting but obviously there is something wrong with my code. Please help me identify the cause of the exception, I just can not see what it could be at the moment. Thank you in advance for your help.
AnswerRe: Object reference not set to an instance of an object Pin
Christian Graus11-Jul-07 15:50
protectorChristian Graus11-Jul-07 15:50 
GeneralRe: Object reference not set to an instance of an object Pin
Rhys Gravell11-Jul-07 20:21
professionalRhys Gravell11-Jul-07 20:21 
AnswerRe: Object reference not set to an instance of an object Pin
Pete O'Hanlon12-Jul-07 2:18
mvePete O'Hanlon12-Jul-07 2:18 
Questiongridview slow Pin
VickyC#11-Jul-07 14:48
VickyC#11-Jul-07 14:48 
AnswerRe: gridview slow Pin
Christian Graus11-Jul-07 14:55
protectorChristian Graus11-Jul-07 14:55 
GeneralRe: gridview slow Pin
VickyC#12-Jul-07 3:28
VickyC#12-Jul-07 3:28 
Questionasp.net 2.0 vb.net Index Server Pin
Michael Clinton11-Jul-07 12:44
Michael Clinton11-Jul-07 12:44 
AnswerRe: asp.net 2.0 vb.net Index Server Pin
Michael Clinton13-Jul-07 12:35
Michael Clinton13-Jul-07 12:35 
QuestionCalender Pop Up and master Page Problem Pin
kidus111-Jul-07 11:33
kidus111-Jul-07 11:33 
AnswerRe: Calender Pop Up and master Page Problem Pin
kjosh11-Jul-07 11:46
kjosh11-Jul-07 11:46 
GeneralRe: Calender Pop Up and master Page Problem Pin
kidus111-Jul-07 11:52
kidus111-Jul-07 11:52 
GeneralRe: Calender Pop Up and master Page Problem Pin
kidus111-Jul-07 11:53
kidus111-Jul-07 11:53 
GeneralRe: Calender Pop Up and master Page Problem Pin
kjosh11-Jul-07 12:10
kjosh11-Jul-07 12:10 
GeneralRe: Calender Pop Up and master Page Problem Pin
kidus112-Jul-07 2:11
kidus112-Jul-07 2:11 
GeneralRe: Calender Pop Up and master Page Problem Pin
Member 186252323-Aug-08 22:55
Member 186252323-Aug-08 22:55 
QuestionMapping database fileds Pin
patelash0111-Jul-07 10:21
patelash0111-Jul-07 10:21 
AnswerRe: Mapping database fileds Pin
Paul Conrad13-Jul-07 12:19
professionalPaul Conrad13-Jul-07 12:19 

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.