Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: buffer too small for string or...

Status
Not open for further replies.

mubaig75

Programmer
Sep 16, 2004
11
CA
Hi Everybody:

I am using visual studio 2002 and crystal reports.Net for reporting off an Access 2000 database with bunch of tables.

The problem is when I start developing report and add database to the report and when i run the report to see if everything is fine then i get the following error message even though i haven't added any fields to the report:

"buffer too small for string or missing null byte"

I don't know if there is a problem with Crystal Report.Net or am i missing any parameter setting some where.

Thanx
 
I'm also getting this error message but in a completely different programming environment. I have a VB6 program that's using old CR PE API calls to process a crystal RPT file (running on CR 8).

I'm trying to stuff/override/replace a servername entry in the PELogonInfo structure. I need to tell the RPT file which alternate database to process from. Kinda like this...
---------------------------------
If Form1.optServer(0).Value = True Then
strServerOrDSNName = "EBISQL"
ElseIf Form1.optServer(1).Value = True Then
strServerOrDSNName = "EBISQLDEV"
ElseIf Form1.optServer(2).Value = True Then
strServerOrDSNName = "EBISQLREP"
End If

'set logon parameters
With udtLogonInfo
.ServerName = Left(strServerOrDSNName & String(PE_SERVERNAME_LEN, vbNullChar), PE_SERVERNAME_LEN)
.DatabaseName = ""
.UserID = ""
.Password = ""
.StructSize = PE_SIZEOF_LOGON_INFO
End With
'now try to force a null character after the new servername
Mid(udtLogonInfo.ServerName, len(servername)+1, 1) = vbNullChar

llRtnCode = PESetNthTableLogOnInfo(hReport, 1, udtLogonInfo, True)
If llRtnCode = 0 Then
ShowCryReportError hReport
Exit Sub
End If
--------------------------------

But whenever I analyze the outcome, the servername field is populated with chr(20) for the entire size of that field (128 bytes minus the actual name of my DSN ). There's not one CHR(0) in the entire string. That's where I'm thinking the error is occurring because it can't find a null byte to limit the size of the field you want.

So maybe it's got something to do with VB messing things up???? Instead of putting in NULL chars, VB is replacing them with SPACES????

Go figure.

So until I can figure out why my assignment code doesn't work, I don;t think CR will generate a report.

Any ideas?

PS. At least this is what I think might be happening to your system. Could be some leftover logic in Crystal's code that never got fixed in .Net either.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top