Friday, March 23, 2012
HELP! Printer Delivery Extension AND Forms Authentication
I need some help with making the Printer Delivery Extension play nicely with
RS equipped with Forms Authentication/Custom Security. We have been using the
forms authentication for some time but just recently decided to implement the
Printer Delivery Extension.
The Problem:
With Forms Authentication, the Printer Delivery Extension CANNOT SEE NETWORK
PRINTERS.
I am sure this has something to do with permissions but what I am unsure
about is how to go about resolving this issue.
Basically when we try to use a network printer and then try to specify that
network printer for a subscription using the Printer Delivery Extension, the
Extension calls the IsValidPrinter() method which loops through the
PrinterSettings.InstalledPrinters collection looking for the printer I
specified. ONLY the local printers are displaying in that collection, no
network printers. I know this because I attached to the process and debugged
it inspecting the contents of that collection. So I know for sure NONE of the
network printers are in there.
Any help would be greatly appreciated!
Thanks,
Nick @. INDATAAre you using 2000 or 2005 version?
--
Markus Pöhler
netpoint-edv gmbh
Germany
"Nick P @. INDATA" wrote:
> Hi,
> I need some help with making the Printer Delivery Extension play nicely with
> RS equipped with Forms Authentication/Custom Security. We have been using the
> forms authentication for some time but just recently decided to implement the
> Printer Delivery Extension.
> The Problem:
> With Forms Authentication, the Printer Delivery Extension CANNOT SEE NETWORK
> PRINTERS.
> I am sure this has something to do with permissions but what I am unsure
> about is how to go about resolving this issue.
> Basically when we try to use a network printer and then try to specify that
> network printer for a subscription using the Printer Delivery Extension, the
> Extension calls the IsValidPrinter() method which loops through the
> PrinterSettings.InstalledPrinters collection looking for the printer I
> specified. ONLY the local printers are displaying in that collection, no
> network printers. I know this because I attached to the process and debugged
> it inspecting the contents of that collection. So I know for sure NONE of the
> network printers are in there.
> Any help would be greatly appreciated!
> Thanks,
> Nick @. INDATA|||SQL Server 2000, RS SP2
"MarkusPoehler" wrote:
> Are you using 2000 or 2005 version?
> --
> Markus Pöhler
> netpoint-edv gmbh
> Germany
>
> "Nick P @. INDATA" wrote:
> > Hi,
> >
> > I need some help with making the Printer Delivery Extension play nicely with
> > RS equipped with Forms Authentication/Custom Security. We have been using the
> > forms authentication for some time but just recently decided to implement the
> > Printer Delivery Extension.
> >
> > The Problem:
> > With Forms Authentication, the Printer Delivery Extension CANNOT SEE NETWORK
> > PRINTERS.
> >
> > I am sure this has something to do with permissions but what I am unsure
> > about is how to go about resolving this issue.
> >
> > Basically when we try to use a network printer and then try to specify that
> > network printer for a subscription using the Printer Delivery Extension, the
> > Extension calls the IsValidPrinter() method which loops through the
> > PrinterSettings.InstalledPrinters collection looking for the printer I
> > specified. ONLY the local printers are displaying in that collection, no
> > network printers. I know this because I attached to the process and debugged
> > it inspecting the contents of that collection. So I know for sure NONE of the
> > network printers are in there.
> >
> > Any help would be greatly appreciated!
> >
> > Thanks,
> >
> > Nick @. INDATA|||Can someone please help?
"Nick P @. INDATA" wrote:
> Hi,
> I need some help with making the Printer Delivery Extension play nicely with
> RS equipped with Forms Authentication/Custom Security. We have been using the
> forms authentication for some time but just recently decided to implement the
> Printer Delivery Extension.
> The Problem:
> With Forms Authentication, the Printer Delivery Extension CANNOT SEE NETWORK
> PRINTERS.
> I am sure this has something to do with permissions but what I am unsure
> about is how to go about resolving this issue.
> Basically when we try to use a network printer and then try to specify that
> network printer for a subscription using the Printer Delivery Extension, the
> Extension calls the IsValidPrinter() method which loops through the
> PrinterSettings.InstalledPrinters collection looking for the printer I
> specified. ONLY the local printers are displaying in that collection, no
> network printers. I know this because I attached to the process and debugged
> it inspecting the contents of that collection. So I know for sure NONE of the
> network printers are in there.
> Any help would be greatly appreciated!
> Thanks,
> Nick @. INDATA
Friday, March 9, 2012
Help! C# - Forms - Datasource
My god.
All I want to do is post the contents of a web form to a database sql express 2005 or access using C#. Why can I find nothing for this very simple process online?
Can you tell I am totally frustrated?
So lets say i have a few text fields and I want to click submit and have that entered into a table. I use C# for code behind. So I can do basic C# programming and I can to webforms with visual web developer 2005 dragging and dropping for textboxs and a button to the aspx page. But then the mystery begins for me. How the hell do I simple post that form data to the table. I understand connection string basics. I aslo can design and create tables.
But tying this all together is becoming a problem. I don't want to use gridview formview detailview or any of that canned UI stuff. I also don't understand VB and when I see VB examples they only cloud my already cloud ASP.NET world.
Please help by posting examples, and maybe some links or books to add to my newbish collection.
Thanks,
Frank
A very simplified example. Hope that will help
<form id="form1" runat="server"> <div> <asp:TextBox ID="txtInput" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtInput" ErrorMessage="Value needed"></asp:RequiredFieldValidator> <br /> <br /> <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="Save" /></div> </form>
and below is the button click event:
string cnStr =""//your connection string herestring valueToSave = txtInput.Text.Trim();string qry =""// your insert query here SqlConnection cn =new SqlConnection(cnStr);cn.Open();SqlCommand cm =new SqlCommand(qry, cn);int i = cm.ExecuteNonQuery();|||
Ok, this looks like what I am looking for but I have two other questions...but first here is my code:
<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox><asp:ButtonID="Button1"runat="server"OnClick="Button1_Click"Text="Button"/>
<asp:LabelID="Label1"runat="server"Text="Label"></asp:Label>string cnStr ="";//connection string stuff here
string name = TextBox1.Text.Trim();
string qry ="insert into [name] value [name]";//insert statement here
SqlConnection cn =new SqlConnection(cnStr);
cn.Open();
SqlCommand cm =new SqlCommand(qry, cn);
int i = cm.ExecuteNonQuery();
when generating a connectionstring I see this in the wizard:
Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True
I made a simple table called 'name' with a text field called 'name' (that sql statement up there might be incorrect as well.
My question is how do I properly format the connection string if it is in app_Data for my project called 'form'?
Second question is my SQL statement correct for inserting a value into 'name'?
Thanks,
Frank
|||
Answer to your second question is no, it will be something like - "insert into name value " ' " + name + " ' ".
And i did not get your first question. If you can provide a little more detail it will be helpful
Sunday, February 19, 2012
Help with update forms
Still very new to asp/sql but trying to learn stuff as I go along.
I'm trying to create an update form where it pulls in an existing record, I
can update it, then submit the changes.
The problem i'm having is when i click to update the record I get this error
message
Cannot update identity column 'id'
In the update form, the ID column is hidden, so i'm not trying to change
that.
How do I get around it?
Thanks for your help.
RichHow are you performing the update? Can you post the actual SQL Statement?
You can't update an IDENTITY column.
David Portas
SQL Server MVP
--|||Hi David
Here's the statement - it was done through dreamweaver, so the code probably
isn't as neat as it should be.
' *** Update Record: set variables
If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <>
"") Then
MM_editConnection = MM_musicone_STRING
MM_editTable = "dbo.m1_web_content"
MM_editColumn = "id"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_editRedirectUrl = "articleupdated.asp"
MM_fieldsStr =
" id|value|Publish_Date|value|Section|valu
e|Section_Type|value|Title|value|In
tro|value|Full_Text|value|LiveDate|value
|HyperLink|value|ImageSrc|value|Live
|value"
MM_columnsStr =
" id|none,none,NULL|Publish_Date|',none,NU
LL|Section|',none,''|Section_Type|'
,none,''|Title|',none,''|Intro|',none,''
|Full_Text|',none,''|LiveDate|',none
,NULL|HyperLink|',none,''|ImageSrc|',non
e,''|Live|none,1,0"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And
Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Update Record: construct a sql update statement and execute it
If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "")
Then
' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " &
MM_recordId
If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
Any advice would be appreciated!
Thanks
Rich
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:zOKdnaCOHNU1EQ7fRVn-gA@.giganews.com...
> How are you performing the update? Can you post the actual SQL Statement?
> You can't update an IDENTITY column.
> --
> David Portas
> SQL Server MVP
> --
>|||It looks like your UPDATE statement is attempting to update every column (in
the FOR loop). Aside from the specific problem you are having this seems
like a very error-prone and inefficient implementation. In general, avoid
generating SQL dynamically in code. Put your data access code in stored
procs and pass parameters from ASP to the proc. I'm not an ASP expert but
here's someone who is and has some tips and examples of good practices in
ASP:
http://www.aspfaq.com/show.asp?id=2201
http://www.aspfaq.com/show.asp?id=2424
David Portas
SQL Server MVP
--|||Thanks David, some really useful info that - much appreciated.
Richard
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:vaqdnR2tCdwjAg7fRVn-gA@.giganews.com...
> It looks like your UPDATE statement is attempting to update every column
> (in the FOR loop). Aside from the specific problem you are having this
> seems like a very error-prone and inefficient implementation. In general,
> avoid generating SQL dynamically in code. Put your data access code in
> stored procs and pass parameters from ASP to the proc. I'm not an ASP
> expert but here's someone who is and has some tips and examples of good
> practices in ASP:
> http://www.aspfaq.com/show.asp?id=2201
> http://www.aspfaq.com/show.asp?id=2424
> --
> David Portas
> SQL Server MVP
> --
>