Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 10-14-2004, 04:06 PM   #1 (permalink)
Junkie
 
CBlend's Avatar
 
Location: Classified
[ASP3]Cannot connect to database 2nd time

I have a page that connects to an Access database successfully, displaying all the rows on the page. However, if I hit refresh, I get an error on the line number where I'm opening the connection to the database. If I wait a while, it works.

I have another page that displays a subset of data from the same table and it also shows an error for the line number where the connection is opened.

If I am on the page that shows the whole table, and click a link to go to the subset table, I will get the error. The same is true the other way around. If I wait a while between opening pages that use the table, the page connects as it should.

I close both my connection and recordset and set both of these to Nothing at the end of the document.

What causes me to not be able to connect a second time without waiting?
I am new to ASP, so I hope this doesn't sound stupid. It is hopefully some easy thing I am missing, and hopefully my description may be enough so someone here can tell me what I should do or what topic to read up on!

Thanks, all!
CBlend is offline  
Old 10-14-2004, 06:34 PM   #2 (permalink)
Tilted
 
Location: Orlando
What is the lock type and cursor type of your recordset? You may be locking yourself out. Also, do you close your connection and recordset objects on the page?
gariig is offline  
Old 10-16-2004, 11:57 AM   #3 (permalink)
Junkie
 
CBlend's Avatar
 
Location: Classified
Ok, I got help from someone at work, so I'll put it here:

objConnection.Timeout = 10 <-- Putting this just before opening the connection solved the problem
CBlend is offline  
Old 10-16-2004, 03:52 PM   #4 (permalink)
Crazy
 
Location: Belgium
common practice for accessing databases is to close the connection as soon as possible.
If you close your connection at the end you can get the following situation:
opening connection -> get data -> click on link for sub-table/refresh -> tries to open connection -> error
why? because the connection to that database is already open. (and locked).
After a while the connection will time out, and you can open it again (as you experienced)
a better way instead of setting the standard time-out to a shorter period would be:
opening connection -> get data -> close connection -> click link for subtable/refresh -> open connection -> get data -> close connection.

Now maybe for an access db this kind of practice isn't -that- important, but as soon as you're using bigger multi-user db's, things like this will get quite important.
__________________
Amerika by Franz Kafka
“As Karl Rossman, a poor boy of sixteen who had been packed off to America by his parents because a servant girl had seduced him and got herself a child by him, stood on the liner slowly entering the harbour of New York, a sudden burst of sunshine seemed to illumine the Statue of Liberty, so that he saw it in a new light, although he had sighted it long before. The arm with the sword rose up as if newly stretched aloft, and round the figure blew the free winds of heaven.”
T.U.B. is offline  
Old 10-24-2004, 06:44 PM   #5 (permalink)
Junkie
 
CBlend's Avatar
 
Location: Classified
Thanks for the extra suggestion, T.U.B.! I will try that as well.
CBlend is offline  
 

Tags
2nd, asp3cannot, connect, database, time


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 01:20 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360