Showing posts with label built. Show all posts
Showing posts with label built. Show all posts

Tuesday, March 27, 2012

Basic problem

I downloaded SQLExpress and Visual Studio Express to my home computer.

I built a simple database, adding data through theSQLexpress admin tool.

I built a web page using MS Studio. I connected to the database and used the webpage for a few days. Then I restarted the computer. Now the web page won't open, and MS Studio won't open the MDF file in the App_Data folder.

I can still see and work in the database through SQL server Express.

The web page and the MSStudio attempt to connect to the mdf file both fail with this message:

Cannot open user default database. Login failed.
Login failed for user 'KAAAK/Administrator'.

So it seems to be trying to connect as the Windows user.

When I try to modify the connection to connect through a user/password I created in SQL manager, I get a message that the user is not a trusted SQL user.

from web.config:

<

connectionStrings>

<

addname="ConnectionString"connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\info.mdf;Integrated Security=True;User Instance=True;User ID=Admin;Password=12345"providerName="System.Data.SqlClient"/>

</

connectionStrings>

That was changed from the original string created automatically by MS Studio

<

connectionStrings>

<

addname="stocksConnectionString"connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\stocks.mdf;Integrated Security=True;User Instance=True;"providerName="System.Data.SqlClient"/>

</

connectionStrings>I am sure this is some simple problem, but why would the system refuse to access an mdf file it had already been accessing.?

Thanks, Michael

Hi!,

This may happen because the SQL server is configure for windows authentication only. Change to mixed mode.

Hope this will help.

Regards

Sunday, March 25, 2012

barcode to image function does not work...

I have built a custom function in my report to convert my barcode data into a
barcode image. The data is a string from the database my images are made
just fine but they are not made as barcodes but as numbers (i.e. 1432808734).
The following is the code I am using:
Public Function CreateBarCodeImage(ByVal sText As String) As Byte()
Dim textLength As Integer = sText.Length
Dim fontSize As Integer = 20
Dim Width As Integer = (fontSize * textLength) - ((fontSize *
textLength) / 3)
Dim Height As Integer = fontSize + 2
'Initialize Graphics
Dim rectF As System.Drawing.RectangleF = New
System.Drawing.RectangleF(0, 0, Width, Height)
Dim pic As System.Drawing.Bitmap = New System.Drawing.Bitmap(Width,
Height, Drawing.Imaging.PixelFormat.Format16bppRgb555)
Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(pic)
g.SmoothingMode = Drawing.Drawing2D.SmoothingMode.AntiAlias
g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
'Set Colors
Dim fontColor As System.Drawing.Color = System.Drawing.Color.FromName("Black")
Dim rectColor As System.Drawing.Color = System.Drawing.Color.FromName("White")
Dim fgBrush As System.Drawing.SolidBrush = New
System.Drawing.SolidBrush(fontColor)
Dim bgBrush As System.Drawing.SolidBrush = New
System.Drawing.SolidBrush(rectColor)
g.FillRectangle(New
System.Drawing.SolidBrush(System.Drawing.Color.White), rectF)
Dim fontName As String = "mrvcode39m.ttf"
Dim style As System.Drawing.FontStyle = Drawing.FontStyle.Regular
Dim font As System.Drawing.Font = New System.Drawing.Font(fontName,
20, style)
Dim format As System.Drawing.StringFormat = New
System.Drawing.StringFormat
g.DrawString(sText, font, fgBrush, rectF, format)
Dim imageBytes() As Byte = Nothing
Dim memoryStream As System.IO.MemoryStream = New
System.IO.MemoryStream
pic.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Bmp)
pic.Dispose()
imageBytes = memoryStream.ToArray()
memoryStream.Close()
Return (imageBytes)
End Function
Can anyone tell me what I am doing wrong? I would like to avoid having to by
something to do this. But I will even do that if someone can help me make it
work.If you're format is CODE 3 of 9 then I suggest that you can use the font for
this.
"CarrieWells" wrote:
> I have built a custom function in my report to convert my barcode data into a
> barcode image. The data is a string from the database my images are made
> just fine but they are not made as barcodes but as numbers (i.e. 1432808734).
> The following is the code I am using:
> Public Function CreateBarCodeImage(ByVal sText As String) As Byte()
> Dim textLength As Integer = sText.Length
> Dim fontSize As Integer = 20
> Dim Width As Integer = (fontSize * textLength) - ((fontSize *
> textLength) / 3)
> Dim Height As Integer = fontSize + 2
> 'Initialize Graphics
> Dim rectF As System.Drawing.RectangleF = New
> System.Drawing.RectangleF(0, 0, Width, Height)
> Dim pic As System.Drawing.Bitmap = New System.Drawing.Bitmap(Width,
> Height, Drawing.Imaging.PixelFormat.Format16bppRgb555)
> Dim g As System.Drawing.Graphics => System.Drawing.Graphics.FromImage(pic)
> g.SmoothingMode = Drawing.Drawing2D.SmoothingMode.AntiAlias
> g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
> 'Set Colors
> Dim fontColor As System.Drawing.Color => System.Drawing.Color.FromName("Black")
> Dim rectColor As System.Drawing.Color => System.Drawing.Color.FromName("White")
> Dim fgBrush As System.Drawing.SolidBrush = New
> System.Drawing.SolidBrush(fontColor)
> Dim bgBrush As System.Drawing.SolidBrush = New
> System.Drawing.SolidBrush(rectColor)
> g.FillRectangle(New
> System.Drawing.SolidBrush(System.Drawing.Color.White), rectF)
> Dim fontName As String = "mrvcode39m.ttf"
> Dim style As System.Drawing.FontStyle = Drawing.FontStyle.Regular
> Dim font As System.Drawing.Font = New System.Drawing.Font(fontName,
> 20, style)
> Dim format As System.Drawing.StringFormat = New
> System.Drawing.StringFormat
> g.DrawString(sText, font, fgBrush, rectF, format)
> Dim imageBytes() As Byte = Nothing
> Dim memoryStream As System.IO.MemoryStream = New
> System.IO.MemoryStream
> pic.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Bmp)
> pic.Dispose()
> imageBytes = memoryStream.ToArray()
> memoryStream.Close()
> Return (imageBytes)
> End Function
> Can anyone tell me what I am doing wrong? I would like to avoid having to by
> something to do this. But I will even do that if someone can help me make it
> work.|||I tried that first but the fields using the 3 of 9 font won't export to
Adobe; the field just shows up blank. My customer has to have that piece of
functionality. All the other posts that talked about this issue said the
solution was to turn the barcoded text into an image. But I can't get my
funtion to work.
I'm sure I've either left soemthing it needs out, I just can't figure out
what.
"Jon Gonzales" wrote:
> If you're format is CODE 3 of 9 then I suggest that you can use the font for
> this.
> "CarrieWells" wrote:
> > I have built a custom function in my report to convert my barcode data into a
> > barcode image. The data is a string from the database my images are made
> > just fine but they are not made as barcodes but as numbers (i.e. 1432808734).
> > The following is the code I am using:
> >
> > Public Function CreateBarCodeImage(ByVal sText As String) As Byte()
> > Dim textLength As Integer = sText.Length
> > Dim fontSize As Integer = 20
> > Dim Width As Integer = (fontSize * textLength) - ((fontSize *
> > textLength) / 3)
> > Dim Height As Integer = fontSize + 2
> >
> > 'Initialize Graphics
> > Dim rectF As System.Drawing.RectangleF = New
> > System.Drawing.RectangleF(0, 0, Width, Height)
> > Dim pic As System.Drawing.Bitmap = New System.Drawing.Bitmap(Width,
> > Height, Drawing.Imaging.PixelFormat.Format16bppRgb555)
> > Dim g As System.Drawing.Graphics => > System.Drawing.Graphics.FromImage(pic)
> >
> > g.SmoothingMode = Drawing.Drawing2D.SmoothingMode.AntiAlias
> > g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
> >
> > 'Set Colors
> > Dim fontColor As System.Drawing.Color => > System.Drawing.Color.FromName("Black")
> > Dim rectColor As System.Drawing.Color => > System.Drawing.Color.FromName("White")
> > Dim fgBrush As System.Drawing.SolidBrush = New
> > System.Drawing.SolidBrush(fontColor)
> > Dim bgBrush As System.Drawing.SolidBrush = New
> > System.Drawing.SolidBrush(rectColor)
> >
> > g.FillRectangle(New
> > System.Drawing.SolidBrush(System.Drawing.Color.White), rectF)
> >
> > Dim fontName As String = "mrvcode39m.ttf"
> > Dim style As System.Drawing.FontStyle = Drawing.FontStyle.Regular
> > Dim font As System.Drawing.Font = New System.Drawing.Font(fontName,
> > 20, style)
> >
> > Dim format As System.Drawing.StringFormat = New
> > System.Drawing.StringFormat
> >
> > g.DrawString(sText, font, fgBrush, rectF, format)
> >
> > Dim imageBytes() As Byte = Nothing
> >
> > Dim memoryStream As System.IO.MemoryStream = New
> > System.IO.MemoryStream
> >
> > pic.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Bmp)
> > pic.Dispose()
> >
> > imageBytes = memoryStream.ToArray()
> > memoryStream.Close()
> >
> > Return (imageBytes)
> > End Function
> >
> > Can anyone tell me what I am doing wrong? I would like to avoid having to by
> > something to do this. But I will even do that if someone can help me make it
> > work.|||When I look into your code, It seems that you use the font also but whats the
code for? Are you aware that you can use the font in design time, as long as
the font was installed in your system. You can just have a TextBox control
with a font of that and set the border and readonly property of the control.
Remember, every computer that uses your system must have the font of code 39
installed on each.
Regards.|||Were you able to get it running? I am having the same problem with
Code 3 of 9.
What is happening on my app. is that in RS it looks fine but when
exporting to PDF, I get the values not converted to C39, just numbers.
this is also happening on zipcode fonts and OCR-A fonts.
"CarrieWells" <CarrieWells@.discussions.microsoft.com> wrote in message news:<F34A7BBB-94D4-47D9-BB9E-706F1AF6C5CB@.microsoft.com>...
> I tried that first but the fields using the 3 of 9 font won't export to
> Adobe; the field just shows up blank. My customer has to have that piece of
> functionality. All the other posts that talked about this issue said the
> solution was to turn the barcoded text into an image. But I can't get my
> funtion to work.
> I'm sure I've either left soemthing it needs out, I just can't figure out
> what.
>
> "Jon Gonzales" wrote:
> > If you're format is CODE 3 of 9 then I suggest that you can use the font for
> > this.
> >
> > "CarrieWells" wrote:
> >
> > > I have built a custom function in my report to convert my barcode data into a
> > > barcode image. The data is a string from the database my images are made
> > > just fine but they are not made as barcodes but as numbers (i.e. 1432808734).
> > > The following is the code I am using:
> > >
> > > Public Function CreateBarCodeImage(ByVal sText As String) As Byte()
> > > Dim textLength As Integer = sText.Length
> > > Dim fontSize As Integer = 20
> > > Dim Width As Integer = (fontSize * textLength) - ((fontSize *
> > > textLength) / 3)
> > > Dim Height As Integer = fontSize + 2
> > >
> > > 'Initialize Graphics
> > > Dim rectF As System.Drawing.RectangleF = New
> > > System.Drawing.RectangleF(0, 0, Width, Height)
> > > Dim pic As System.Drawing.Bitmap = New System.Drawing.Bitmap(Width,
> > > Height, Drawing.Imaging.PixelFormat.Format16bppRgb555)
> > > Dim g As System.Drawing.Graphics => > > System.Drawing.Graphics.FromImage(pic)
> > >
> > > g.SmoothingMode = Drawing.Drawing2D.SmoothingMode.AntiAlias
> > > g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
> > >
> > > 'Set Colors
> > > Dim fontColor As System.Drawing.Color => > > System.Drawing.Color.FromName("Black")
> > > Dim rectColor As System.Drawing.Color => > > System.Drawing.Color.FromName("White")
> > > Dim fgBrush As System.Drawing.SolidBrush = New
> > > System.Drawing.SolidBrush(fontColor)
> > > Dim bgBrush As System.Drawing.SolidBrush = New
> > > System.Drawing.SolidBrush(rectColor)
> > >
> > > g.FillRectangle(New
> > > System.Drawing.SolidBrush(System.Drawing.Color.White), rectF)
> > >
> > > Dim fontName As String = "mrvcode39m.ttf"
> > > Dim style As System.Drawing.FontStyle = Drawing.FontStyle.Regular
> > > Dim font As System.Drawing.Font = New System.Drawing.Font(fontName,
> > > 20, style)
> > >
> > > Dim format As System.Drawing.StringFormat = New
> > > System.Drawing.StringFormat
> > >
> > > g.DrawString(sText, font, fgBrush, rectF, format)
> > >
> > > Dim imageBytes() As Byte = Nothing
> > >
> > > Dim memoryStream As System.IO.MemoryStream = New
> > > System.IO.MemoryStream
> > >
> > > pic.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Bmp)
> > > pic.Dispose()
> > >
> > > imageBytes = memoryStream.ToArray()
> > > memoryStream.Close()
> > >
> > > Return (imageBytes)
> > > End Function
> > >
> > > Can anyone tell me what I am doing wrong? I would like to avoid having to by
> > > something to do this. But I will even do that if someone can help me make it
> > > work.

Tuesday, March 20, 2012

baffled .. no data returned to web browser

Hi.
I have a parameter driven report that has been built and deployed
succesfully with no errors.
After execution of the report I am just left with the format of my
report in my web browser i.e. no data is displayed.
However ...when I run the exact same SP from query analyzer I receive
the correct result set.
In the executionlog table the executioon of the report is marked as
successfull and that a certain amount of bytes have been returned to
the client...
The amount of pages are also displayed indicating to me that it knows
it has received data'
Anyone have any ideas'
LCan you export the report from the web browser? And if so, how does it
look there?

Friday, February 24, 2012

Backup-Restore on Encrypted Columns

I have some columns that are encrypted using SQL Server 2005 built in
encryption. What happens when I backup and restore this database on another
server? Does SQL Server have to re-encrypt these columns on this new
server? The Master Key is different on the new server, right?
--IKEThe Service Master Key is different, yes. The Database Master Key and all
other keys in the database were carried over with your data.
So the only thing that you may need to do is to re-encrypt the Database
Master Key with the Service Master Key of the new server, if you had such SM
K
encryption on the old server as well. To do this, you need to do the
following steps while connected to the database:
-- open the database master key
OPEN MASTER KEY DECRYPTION BY PASSWORD = 'whatever_password'
-- re-encrypt with the current server's SMK
ALTER MASTER KEY ADD ENCRYPTION BY SERVICE MASTER KEY
For more info about these statements, see:
http://msdn2.microsoft.com/en-us/library/ms130214.aspx
http://msdn2.microsoft.com/en-us/library/ms186937.aspx
This scenario was also discussed here:
http://blogs.msdn.com/lcris/archive.../30/475822.aspx
Thanks
Laurentiu Cristofor [MSFT]
Software Design Engineer
SQL Server Engine
http://blogs.msdn.com/lcris/
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ike the Potato" wrote:

> I have some columns that are encrypted using SQL Server 2005 built in
> encryption. What happens when I backup and restore this database on anoth
er
> server? Does SQL Server have to re-encrypt these columns on this new
> server? The Master Key is different on the new server, right?
> --IKE
>
>