| Home | Forums | Reviews | Articles | Register |
![]() |
| Thread Tools | Rate Thread |
|
|
|
| |
|
Andy Barber
Guest
Posts: n/a
|
Thanks CJ.
Been so used to coding ASP an VB didn't realise .net was that different. Thansks for the namespace pointer I can go dig around. Andy >-----Original Message----- > >This looks like VB6, in which case this is the wrong board, but I'll throw >an answer your way. And if its Not VB6, and this is how your coding .NET... >go buy a book. Becuase this is bad. Really bad... > >Don't take that offensivly, but your late binding (if binding a datatype at >all to everything) > >First of all, if you get a Object null error (not set to instance) you have >to use the new constructor. And since you didn't tell us where exactly it >was bombing, I could see about 8 places it would. > >for example, dont declare something without a datatype. (Dim rstFileds) > >do > >Dim rstFields as ADODB.Recordset. > >Second of all, if this is .NET code, then don't use ADODB. Use the >System.data namespace. > >If you don't know what that is... > >put it back in the box, and buy a book... then you may have it back. > >-CJ > >"Andy Barber" <(E-Mail Removed)> wrote in message >news:050901c367e3$ed8ffea0$(E-Mail Removed)... >> Hi, >> >> I'm trying to write an app that reads data from a table >> into a string variable for later use in my program. >> Below is a snippet of the code I'm using, which compiles >> ok, but at runtime I get and error 'Object reference not >> set to an instance of an object.' as soon as I try to >> access the data in the fields, I.e. at the line that >> reads 'KeyFlags(i) = rstFields("keyflag").value' >> >> Anyone tell me where I'm going wrong? >> >> strSQL = "SELECT fieldname, keyflag, >> mandatoryflag ,vendorKey,tablename from field_relates " >> strSQL = strSQL & "where fieldname = '" & >> Remove_Quotes(namearray(i)) & "' AND tablename = '" & >> CmdArgs(0) & "'" >> Dim rstFields >> rstFields = CreateObject("ADODB.Recordset") >> rstFields.open(strSQL, strConn) >> If rstFields.eof Then >> MsgBox("**Error:- Field name " & namearray >> (i) & " not registered for " & CmdArgs(0) & " load at >> position " & i + 1) >> FileClose(1) >> Return 4 >> End If >> KeyFlags(i) = rstFields("keyflag").value >> MandatoryFlags(i) = rstFields >> ("mandatoryflag").value >> VendorKey(i) = rstFields("VendorKey").value >> If MandatoryFlags(i) = "Y" Then ManCount += 1 >> If VendorKey(i) = "Y" Then VenCount += 1 >> rstFields.close() >> >> >> > > >. > |
|
||
|
||||
|
CJ Taylor
Guest
Posts: n/a
|
Andy,
Not a problem. Actually, if you really want to get a handle on VB.NET vs VB6, read a book by Dan Appleman, *amazon link below*. One, its really easy reading, I read it in 2 and a half days because I couldn't put it down. But I'm a super nerd. It will show you some understanding of how it all comes together. Especially moving from ADO 2.5+ to ADOX (the .NET ADO). Which is COMPLETLY different than ADO 2.7. It will throw you off at first. But make sure you understand datasets, and once you do, you will be like "Wow... I've wanted that for years!" Also, if you write Dan, he responds to you in a short time. Really nice guy too. Good luck and let me know if you need anything else. -CJ http://www.amazon.com/exec/obidos/tg...books&n=507846 "Andy Barber" <(E-Mail Removed)> wrote in message news:059901c367ea$304285a0$(E-Mail Removed)... > Thanks CJ. > > Been so used to coding ASP an VB didn't realise .net was > that different. Thansks for the namespace pointer I can > go dig around. > > Andy > >-----Original Message----- > > > >This looks like VB6, in which case this is the wrong > board, but I'll throw > >an answer your way. And if its Not VB6, and this is how > your coding .NET... > >go buy a book. Becuase this is bad. Really bad... > > > >Don't take that offensivly, but your late binding (if > binding a datatype at > >all to everything) > > > >First of all, if you get a Object null error (not set to > instance) you have > >to use the new constructor. And since you didn't tell us > where exactly it > >was bombing, I could see about 8 places it would. > > > >for example, dont declare something without a datatype. > (Dim rstFileds) > > > >do > > > >Dim rstFields as ADODB.Recordset. > > > >Second of all, if this is .NET code, then don't use > ADODB. Use the > >System.data namespace. > > > >If you don't know what that is... > > > >put it back in the box, and buy a book... then you may > have it back. > > > >-CJ > > > >"Andy Barber" <(E-Mail Removed)> wrote in message > >news:050901c367e3$ed8ffea0$(E-Mail Removed)... > >> Hi, > >> > >> I'm trying to write an app that reads data from a table > >> into a string variable for later use in my program. > >> Below is a snippet of the code I'm using, which compiles > >> ok, but at runtime I get and error 'Object reference not > >> set to an instance of an object.' as soon as I try to > >> access the data in the fields, I.e. at the line that > >> reads 'KeyFlags(i) = rstFields("keyflag").value' > >> > >> Anyone tell me where I'm going wrong? > >> > >> strSQL = "SELECT fieldname, keyflag, > >> mandatoryflag ,vendorKey,tablename from field_relates " > >> strSQL = strSQL & "where fieldname = '" & > >> Remove_Quotes(namearray(i)) & "' AND tablename = '" & > >> CmdArgs(0) & "'" > >> Dim rstFields > >> rstFields = CreateObject("ADODB.Recordset") > >> rstFields.open(strSQL, strConn) > >> If rstFields.eof Then > >> MsgBox("**Error:- Field name " & > namearray > >> (i) & " not registered for " & CmdArgs(0) & " load at > >> position " & i + 1) > >> FileClose(1) > >> Return 4 > >> End If > >> KeyFlags(i) = rstFields("keyflag").value > >> MandatoryFlags(i) = rstFields > >> ("mandatoryflag").value > >> VendorKey(i) = rstFields("VendorKey").value > >> If MandatoryFlags(i) = "Y" Then ManCount += > 1 > >> If VendorKey(i) = "Y" Then VenCount += 1 > >> rstFields.close() > >> > >> > >> > > > > > >. > > |
|
||
|
||||
|
Andy Barber
Guest
Posts: n/a
|
Thanks for Link CJ, Will look int tordering it.
Maybe you can tell me if I'm using the right tools to do this job, this Is wat I have.. A CSV data file with column headings in the first row. These cloum headings to be validated against data in a reference table on an SQLServer database. Data from the CSV file is to be validated and inserted into relevant tables on the SQLServer database. Errors to be output to a log file. No user interface. I thought I could use a console app to do this. Am I right? Andy >-----Original Message----- >Andy, > >Not a problem. Actually, if you really want to get a handle on VB.NET vs >VB6, read a book by Dan Appleman, *amazon link below*. One, its really >easy reading, I read it in 2 and a half days because I couldn't put it down. >But I'm a super nerd. > >It will show you some understanding of how it all comes together. >Especially moving from ADO 2.5+ to ADOX (the .NET ADO). Which is COMPLETLY >different than ADO 2.7. It will throw you off at first. But make sure you >understand datasets, and once you do, you will be like "Wow... I've wanted >that for years!" > >Also, if you write Dan, he responds to you in a short time. Really nice guy >too. > >Good luck and let me know if you need anything else. > >-CJ > >http://www.amazon.com/exec/obidos/tg/detail/- /159059102X/qid=1061473579/sr=8-3/ref=sr_8_3/002-9246455- 0548054?v=glance&s=books&n=507846 > > >"Andy Barber" <(E-Mail Removed)> wrote in message >news:059901c367ea$304285a0$(E-Mail Removed)... >> Thanks CJ. >> >> Been so used to coding ASP an VB didn't realise .net was >> that different. Thansks for the namespace pointer I can >> go dig around. >> >> Andy >> >-----Original Message----- >> > >> >This looks like VB6, in which case this is the wrong >> board, but I'll throw >> >an answer your way. And if its Not VB6, and this is how >> your coding .NET... >> >go buy a book. Becuase this is bad. Really bad... >> > >> >Don't take that offensivly, but your late binding (if >> binding a datatype at >> >all to everything) >> > >> >First of all, if you get a Object null error (not set to >> instance) you have >> >to use the new constructor. And since you didn't tell us >> where exactly it >> >was bombing, I could see about 8 places it would. >> > >> >for example, dont declare something without a datatype. >> (Dim rstFileds) >> > >> >do >> > >> >Dim rstFields as ADODB.Recordset. >> > >> >Second of all, if this is .NET code, then don't use >> ADODB. Use the >> >System.data namespace. >> > >> >If you don't know what that is... >> > >> >put it back in the box, and buy a book... then you may >> have it back. >> > >> >-CJ >> > >> >"Andy Barber" <(E-Mail Removed)> wrote in message >> >news:050901c367e3$ed8ffea0$(E-Mail Removed)... >> >> Hi, >> >> >> >> I'm trying to write an app that reads data from a table >> >> into a string variable for later use in my program. >> >> Below is a snippet of the code I'm using, which compiles >> >> ok, but at runtime I get and error 'Object reference not >> >> set to an instance of an object.' as soon as I try to >> >> access the data in the fields, I.e. at the line that >> >> reads 'KeyFlags(i) = rstFields("keyflag").value' >> >> >> >> Anyone tell me where I'm going wrong? >> >> >> >> strSQL = "SELECT fieldname, keyflag, >> >> mandatoryflag ,vendorKey,tablename from field_relates " >> >> strSQL = strSQL & "where fieldname = '" & >> >> Remove_Quotes(namearray(i)) & "' AND tablename = '" & >> >> CmdArgs(0) & "'" >> >> Dim rstFields >> >> rstFields = CreateObject ("ADODB.Recordset") >> >> rstFields.open(strSQL, strConn) >> >> If rstFields.eof Then >> >> MsgBox("**Error:- Field name " & >> namearray >> >> (i) & " not registered for " & CmdArgs(0) & " load at >> >> position " & i + 1) >> >> FileClose(1) >> >> Return 4 >> >> End If >> >> KeyFlags(i) = rstFields("keyflag").value >> >> MandatoryFlags(i) = rstFields >> >> ("mandatoryflag").value >> >> VendorKey(i) = rstFields ("VendorKey").value >> >> If MandatoryFlags(i) = "Y" Then ManCount += >> 1 >> >> If VendorKey(i) = "Y" Then VenCount += 1 >> >> rstFields.close() >> >> >> >> >> >> >> > >> > >> >. >> > > > >. > |
|
||
|
||||
|
CJ Taylor
Guest
Posts: n/a
|
Andy,
> Thanks for Link CJ, Will look int tordering it. > > Maybe you can tell me if I'm using the right tools to do > this job, this Is wat I have.. > > A CSV data file with column headings in the first row. > These cloum headings to be validated against data in a > reference table on an SQLServer database. > Make your life simple, use the ASCII ODBC driver to read CSV's. you'll shorten the amount of code you have to write. And then you can just cross datasets. > Data from the CSV file is to be validated and inserted > into relevant tables on the SQLServer database. > using XML datasets you can validate. little more work when you enforce constraints, but thats ok. well worth it and takes care of all the GIGO for you. (You have to do some work, but not a lot in comparison to what you WOULD do to check integrity of your data. > Errors to be output to a log file. No user interface. > > I thought I could use a console app to do this. Am I > right? > Console app is fine, windows app is fine. doens't really matter. You can have a windows application that has no windows interface, just has a Sub Main(). You can set that in your project properties, it will take care of the rest. > Andy > >-----Original Message----- > >Andy, > > > >Not a problem. Actually, if you really want to get a > handle on VB.NET vs > >VB6, read a book by Dan Appleman, *amazon link below*. > One, its really > >easy reading, I read it in 2 and a half days because I > couldn't put it down. > >But I'm a super nerd. > > > >It will show you some understanding of how it all comes > together. > >Especially moving from ADO 2.5+ to ADOX (the .NET ADO). > Which is COMPLETLY > >different than ADO 2.7. It will throw you off at first. > But make sure you > >understand datasets, and once you do, you will be > like "Wow... I've wanted > >that for years!" > > > >Also, if you write Dan, he responds to you in a short > time. Really nice guy > >too. > > > >Good luck and let me know if you need anything else. > > > >-CJ > > > >http://www.amazon.com/exec/obidos/tg/detail/- > /159059102X/qid=1061473579/sr=8-3/ref=sr_8_3/002-9246455- > 0548054?v=glance&s=books&n=507846 > > > > > >"Andy Barber" <(E-Mail Removed)> wrote in message > >news:059901c367ea$304285a0$(E-Mail Removed)... > >> Thanks CJ. > >> > >> Been so used to coding ASP an VB didn't realise .net was > >> that different. Thansks for the namespace pointer I can > >> go dig around. > >> > >> Andy > >> >-----Original Message----- > >> > > >> >This looks like VB6, in which case this is the wrong > >> board, but I'll throw > >> >an answer your way. And if its Not VB6, and this is > how > >> your coding .NET... > >> >go buy a book. Becuase this is bad. Really bad... > >> > > >> >Don't take that offensivly, but your late binding (if > >> binding a datatype at > >> >all to everything) > >> > > >> >First of all, if you get a Object null error (not set > to > >> instance) you have > >> >to use the new constructor. And since you didn't tell > us > >> where exactly it > >> >was bombing, I could see about 8 places it would. > >> > > >> >for example, dont declare something without a datatype. > >> (Dim rstFileds) > >> > > >> >do > >> > > >> >Dim rstFields as ADODB.Recordset. > >> > > >> >Second of all, if this is .NET code, then don't use > >> ADODB. Use the > >> >System.data namespace. > >> > > >> >If you don't know what that is... > >> > > >> >put it back in the box, and buy a book... then you may > >> have it back. > >> > > >> >-CJ > >> > > >> >"Andy Barber" <(E-Mail Removed)> wrote in > message > >> >news:050901c367e3$ed8ffea0$(E-Mail Removed)... > >> >> Hi, > >> >> > >> >> I'm trying to write an app that reads data from a > table > >> >> into a string variable for later use in my program. > >> >> Below is a snippet of the code I'm using, which > compiles > >> >> ok, but at runtime I get and error 'Object reference > not > >> >> set to an instance of an object.' as soon as I try to > >> >> access the data in the fields, I.e. at the line that > >> >> reads 'KeyFlags(i) = rstFields("keyflag").value' > >> >> > >> >> Anyone tell me where I'm going wrong? > >> >> > >> >> strSQL = "SELECT fieldname, keyflag, > >> >> mandatoryflag ,vendorKey,tablename from > field_relates " > >> >> strSQL = strSQL & "where fieldname = '" & > >> >> Remove_Quotes(namearray(i)) & "' AND tablename = '" & > >> >> CmdArgs(0) & "'" > >> >> Dim rstFields > >> >> rstFields = CreateObject > ("ADODB.Recordset") > >> >> rstFields.open(strSQL, strConn) > >> >> If rstFields.eof Then > >> >> MsgBox("**Error:- Field name " & > >> namearray > >> >> (i) & " not registered for " & CmdArgs(0) & " load at > >> >> position " & i + 1) > >> >> FileClose(1) > >> >> Return 4 > >> >> End If > >> >> KeyFlags(i) = rstFields("keyflag").value > >> >> MandatoryFlags(i) = rstFields > >> >> ("mandatoryflag").value > >> >> VendorKey(i) = rstFields > ("VendorKey").value > >> >> If MandatoryFlags(i) = "Y" Then ManCount > += > >> 1 > >> >> If VendorKey(i) = "Y" Then VenCount += 1 > >> >> rstFields.close() > >> >> > >> >> > >> >> > >> > > >> > > >> >. > >> > > > > > > >. > > |
|
||
|
||||
|
Andy Barber
Guest
Posts: n/a
|
Arrrg.
Wanted to use ODBC to start with since I have ODBC connections to both the dabase and the flat files, but couldn't get it to work. Do you know of anywhere I can find some simple samples, that DON'T use forms, that will set up an odbc link, read data into variable and write daa back to link? I've ordered the book, just hope it arrives firly quickly Your help is MUCH appreciated, I think I've thrown myself into the deep end here and am swimming under water, but don't knw which direction the surface is ![]() Andy >-----Original Message----- >Andy, > >> Thanks for Link CJ, Will look int tordering it. >> >> Maybe you can tell me if I'm using the right tools to do >> this job, this Is wat I have.. >> >> A CSV data file with column headings in the first row. >> These cloum headings to be validated against data in a >> reference table on an SQLServer database. >> > >Make your life simple, use the ASCII ODBC driver to read CSV's. you'll >shorten the amount of code you have to write. And then you can just cross >datasets. > > >> Data from the CSV file is to be validated and inserted >> into relevant tables on the SQLServer database. >> > >using XML datasets you can validate. little more work when you enforce >constraints, but thats ok. well worth it and takes care of all the GIGO for >you. (You have to do some work, but not a lot in comparison to what you >WOULD do to check integrity of your data. > >> Errors to be output to a log file. No user interface. >> >> I thought I could use a console app to do this. Am I >> right? >> >Console app is fine, windows app is fine. doens't really matter. You can >have a windows application that has no windows interface, just has a Sub >Main(). You can set that in your project properties, it will take care of >the rest. > >> Andy >> >-----Original Message----- >> >Andy, >> > >> >Not a problem. Actually, if you really want to get a >> handle on VB.NET vs >> >VB6, read a book by Dan Appleman, *amazon link below*. >> One, its really >> >easy reading, I read it in 2 and a half days because I >> couldn't put it down. >> >But I'm a super nerd. >> > >> >It will show you some understanding of how it all comes >> together. >> >Especially moving from ADO 2.5+ to ADOX (the .NET ADO). >> Which is COMPLETLY >> >different than ADO 2.7. It will throw you off at first. >> But make sure you >> >understand datasets, and once you do, you will be >> like "Wow... I've wanted >> >that for years!" >> > >> >Also, if you write Dan, he responds to you in a short >> time. Really nice guy >> >too. >> > >> >Good luck and let me know if you need anything else. >> > >> >-CJ >> > >> >http://www.amazon.com/exec/obidos/tg/detail/- >> /159059102X/qid=1061473579/sr=8-3/ref=sr_8_3/002- 9246455- >> 0548054?v=glance&s=books&n=507846 >> > >> > >> >"Andy Barber" <(E-Mail Removed)> wrote in message >> >news:059901c367ea$304285a0$(E-Mail Removed)... >> >> Thanks CJ. >> >> >> >> Been so used to coding ASP an VB didn't realise .net was >> >> that different. Thansks for the namespace pointer I can >> >> go dig around. >> >> >> >> Andy >> >> >-----Original Message----- >> >> > >> >> >This looks like VB6, in which case this is the wrong >> >> board, but I'll throw >> >> >an answer your way. And if its Not VB6, and this is >> how >> >> your coding .NET... >> >> >go buy a book. Becuase this is bad. Really bad... >> >> > >> >> >Don't take that offensivly, but your late binding (if >> >> binding a datatype at >> >> >all to everything) >> >> > >> >> >First of all, if you get a Object null error (not set >> to >> >> instance) you have >> >> >to use the new constructor. And since you didn't tell >> us >> >> where exactly it >> >> >was bombing, I could see about 8 places it would. >> >> > >> >> >for example, dont declare something without a datatype. >> >> (Dim rstFileds) >> >> > >> >> >do >> >> > >> >> >Dim rstFields as ADODB.Recordset. >> >> > >> >> >Second of all, if this is .NET code, then don't use >> >> ADODB. Use the >> >> >System.data namespace. >> >> > >> >> >If you don't know what that is... >> >> > >> >> >put it back in the box, and buy a book... then you may >> >> have it back. >> >> > >> >> >-CJ >> >> > >> >> >"Andy Barber" <(E-Mail Removed)> wrote in >> message >> >> >news:050901c367e3$ed8ffea0$(E-Mail Removed)... >> >> >> Hi, >> >> >> >> >> >> I'm trying to write an app that reads data from a >> table >> >> >> into a string variable for later use in my program. >> >> >> Below is a snippet of the code I'm using, which >> compiles >> >> >> ok, but at runtime I get and error 'Object reference >> not >> >> >> set to an instance of an object.' as soon as I try to >> >> >> access the data in the fields, I.e. at the line that >> >> >> reads 'KeyFlags(i) = rstFields("keyflag").value' >> >> >> >> >> >> Anyone tell me where I'm going wrong? >> >> >> >> >> >> strSQL = "SELECT fieldname, keyflag, >> >> >> mandatoryflag ,vendorKey,tablename from >> field_relates " >> >> >> strSQL = strSQL & "where fieldname = '" & >> >> >> Remove_Quotes(namearray(i)) & "' AND tablename = '" & >> >> >> CmdArgs(0) & "'" >> >> >> Dim rstFields >> >> >> rstFields = CreateObject >> ("ADODB.Recordset") >> >> >> rstFields.open(strSQL, strConn) >> >> >> If rstFields.eof Then >> >> >> MsgBox("**Error:- Field name " & >> >> namearray >> >> >> (i) & " not registered for " & CmdArgs(0) & " load at >> >> >> position " & i + 1) >> >> >> FileClose(1) >> >> >> Return 4 >> >> >> End If >> >> >> KeyFlags(i) = rstFields ("keyflag").value >> >> >> MandatoryFlags(i) = rstFields >> >> >> ("mandatoryflag").value >> >> >> VendorKey(i) = rstFields >> ("VendorKey").value >> >> >> If MandatoryFlags(i) = "Y" Then ManCount >> += >> >> 1 >> >> >> If VendorKey(i) = "Y" Then VenCount += 1 >> >> >> rstFields.close() >> >> >> >> >> >> >> >> >> >> >> > >> >> > >> >> >. >> >> > >> > >> > >> >. >> > > > >. > |
|
||
|
||||
|
CJ Taylor
Guest
Posts: n/a
|
Andy,
Alright, First of all, I'm assuming your using VS.NET 2002. Just because you don't have the drag and drop ODBC drivers from MS. (the first ones that came out sucked). As for samples, you can always use Planet Source Code (www.planetsourcecode.com), there is some good stuff there. As for using ODBC for both, I would advise agsint it, just because the OLEDB drivers for SQL server are really really good. =) I like em at least, but I'm sure someone has SOME problem with them. but so far they have done everything I wanted. Here is what you have to remember about VB -> VB.NET. Ok, you remember how you have teh form designer in VB6? Well, you have that, but it creates objects in the code behind (Look at the region Windows Form Designer Generated code or something). So, the IDE is just there to make it simple, but you can code VB.NET forms without an IDE (though it would be long and tiresome, like watching Legally Blonde 2). So. you can have a form, with nothing on it if you want. (if you want to save some steps and headaches of already switching to a language called VB, but honestly it isn't VB. VB.NET is nothing like VB6, except for Dim, Sub and Function. =) ) If you have 2003, then you have the ODBC drivers already there. That saves time. Also, most important thing you can ever take from me is this. Everything is an object. If you can understand that, you can understand .NET. As far as throwing yourself into the deep and and trying to swim... Yeah, you did. But ask yourself this. How else are you going to learn it? Taking a college extension course over the next 9 months learning how to write a friggin single form app (because most college professors don't understand the difference between MDI forms and other. Don't even get me start on Event handlers with them.) I'm always happy to help out too.. feel free to email if you want. I just post here so everyone can benefit. I was in the same position (I had a java background though) in which case I looked at VB.NET and said "What the f*** is this?" Take care, CJ > Arrrg. > > Wanted to use ODBC to start with since I have ODBC > connections to both the dabase and the flat files, but > couldn't get it to work. > Do you know of anywhere I can find some simple samples, > that DON'T use forms, that will set up an odbc link, read > data into variable and write daa back to link? > I've ordered the book, just hope it arrives firly quickly > > Your help is MUCH appreciated, I think I've thrown myself > into the deep end here and am swimming under water, but > don't knw which direction the surface is ![]() > > Andy > >-----Original Message----- > >Andy, > > > >> Thanks for Link CJ, Will look int tordering it. > >> > >> Maybe you can tell me if I'm using the right tools to > do > >> this job, this Is wat I have.. > >> > >> A CSV data file with column headings in the first row. > >> These cloum headings to be validated against data in a > >> reference table on an SQLServer database. > >> > > > >Make your life simple, use the ASCII ODBC driver to read > CSV's. you'll > >shorten the amount of code you have to write. And then > you can just cross > >datasets. > > > > > >> Data from the CSV file is to be validated and inserted > >> into relevant tables on the SQLServer database. > >> > > > >using XML datasets you can validate. little more work > when you enforce > >constraints, but thats ok. well worth it and takes care > of all the GIGO for > >you. (You have to do some work, but not a lot in > comparison to what you > >WOULD do to check integrity of your data. > > > >> Errors to be output to a log file. No user interface. > >> > >> I thought I could use a console app to do this. Am I > >> right? > >> > >Console app is fine, windows app is fine. doens't really > matter. You can > >have a windows application that has no windows interface, > just has a Sub > >Main(). You can set that in your project properties, it > will take care of > >the rest. > > > >> Andy > >> >-----Original Message----- > >> >Andy, > >> > > >> >Not a problem. Actually, if you really want to get a > >> handle on VB.NET vs > >> >VB6, read a book by Dan Appleman, *amazon link below*. > >> One, its really > >> >easy reading, I read it in 2 and a half days because I > >> couldn't put it down. > >> >But I'm a super nerd. > >> > > >> >It will show you some understanding of how it all comes > >> together. > >> >Especially moving from ADO 2.5+ to ADOX (the .NET ADO). > >> Which is COMPLETLY > >> >different than ADO 2.7. It will throw you off at > first. > >> But make sure you > >> >understand datasets, and once you do, you will be > >> like "Wow... I've wanted > >> >that for years!" > >> > > >> >Also, if you write Dan, he responds to you in a short > >> time. Really nice guy > >> >too. > >> > > >> >Good luck and let me know if you need anything else. > >> > > >> >-CJ > >> > > >> >http://www.amazon.com/exec/obidos/tg/detail/- > >> /159059102X/qid=1061473579/sr=8-3/ref=sr_8_3/002- > 9246455- > >> 0548054?v=glance&s=books&n=507846 > >> > > >> > > >> >"Andy Barber" <(E-Mail Removed)> wrote in > message > >> >news:059901c367ea$304285a0$(E-Mail Removed)... > >> >> Thanks CJ. > >> >> > >> >> Been so used to coding ASP an VB didn't realise .net > was > >> >> that different. Thansks for the namespace pointer I > can > >> >> go dig around. > >> >> > >> >> Andy > >> >> >-----Original Message----- > >> >> > > >> >> >This looks like VB6, in which case this is the wrong > >> >> board, but I'll throw > >> >> >an answer your way. And if its Not VB6, and this is > >> how > >> >> your coding .NET... > >> >> >go buy a book. Becuase this is bad. Really bad... > >> >> > > >> >> >Don't take that offensivly, but your late binding > (if > >> >> binding a datatype at > >> >> >all to everything) > >> >> > > >> >> >First of all, if you get a Object null error (not > set > >> to > >> >> instance) you have > >> >> >to use the new constructor. And since you didn't > tell > >> us > >> >> where exactly it > >> >> >was bombing, I could see about 8 places it would. > >> >> > > >> >> >for example, dont declare something without a > datatype. > >> >> (Dim rstFileds) > >> >> > > >> >> >do > >> >> > > >> >> >Dim rstFields as ADODB.Recordset. > >> >> > > >> >> >Second of all, if this is .NET code, then don't use > >> >> ADODB. Use the > >> >> >System.data namespace. > >> >> > > >> >> >If you don't know what that is... > >> >> > > >> >> >put it back in the box, and buy a book... then you > may > >> >> have it back. > >> >> > > >> >> >-CJ > >> >> > > >> >> >"Andy Barber" <(E-Mail Removed)> wrote in > >> message > >> >> >news:050901c367e3$ed8ffea0$(E-Mail Removed)... > >> >> >> Hi, > >> >> >> > >> >> >> I'm trying to write an app that reads data from a > >> table > >> >> >> into a string variable for later use in my > program. > >> >> >> Below is a snippet of the code I'm using, which > >> compiles > >> >> >> ok, but at runtime I get and error 'Object > reference > >> not > >> >> >> set to an instance of an object.' as soon as I > try to > >> >> >> access the data in the fields, I.e. at the line > that > >> >> >> reads 'KeyFlags(i) = rstFields("keyflag").value' > >> >> >> > >> >> >> Anyone tell me where I'm going wrong? > >> >> >> > >> >> >> strSQL = "SELECT fieldname, keyflag, > >> >> >> mandatoryflag ,vendorKey,tablename from > >> field_relates " > >> >> >> strSQL = strSQL & "where fieldname > = '" & > >> >> >> Remove_Quotes(namearray(i)) & "' AND tablename > = '" & > >> >> >> CmdArgs(0) & "'" > >> >> >> Dim rstFields > >> >> >> rstFields = CreateObject > >> ("ADODB.Recordset") > >> >> >> rstFields.open(strSQL, strConn) > >> >> >> If rstFields.eof Then > >> >> >> MsgBox("**Error:- Field name " & > >> >> namearray > >> >> >> (i) & " not registered for " & CmdArgs(0) & " > load at > >> >> >> position " & i + 1) > >> >> >> FileClose(1) > >> >> >> Return 4 > >> >> >> End If > >> >> >> KeyFlags(i) = rstFields > ("keyflag").value > >> >> >> MandatoryFlags(i) = rstFields > >> >> >> ("mandatoryflag").value > >> >> >> VendorKey(i) = rstFields > >> ("VendorKey").value > >> >> >> If MandatoryFlags(i) = "Y" Then > ManCount > >> += > >> >> 1 > >> >> >> If VendorKey(i) = "Y" Then VenCount > += 1 > >> >> >> rstFields.close() > >> >> >> > >> >> >> > >> >> >> > >> >> > > >> >> > > >> >> >. > >> >> > > >> > > >> > > >> >. > >> > > > > > > >. > > |
|
||
|
||||
|
|
|
| |
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to load data in ListBox using one command from ADODB RecordSet | =?Utf-8?B?QWxwZXNoIFBhdGVs?= | Microsoft Access | 3 | 24th Aug 2005 10:35 AM |
| How to load data in ListBox using one command from ADODB RecordSet | =?Utf-8?B?QWxwZXNoIFBhdGVs?= | Microsoft Access Getting Started | 3 | 22nd Aug 2005 10:54 PM |
| Populating disconnected ADODB.Recordset with System.Data.DataTable data. | elcc1958@yahoo.com | Microsoft ADO .NET | 4 | 31st May 2004 02:31 PM |
| Populating disconnected ADODB.Recordset with System.Data.DataTable data. | elcc1958@yahoo.com | Microsoft Dot NET | 0 | 11th May 2004 03:43 PM |
| accessing ADODB Recordset problem | Microsoft VB .NET | 3 | 3rd Mar 2004 11:49 PM | |
Powered by vBulletin®. Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2010, Crawlability, Inc. |




