|
261
|
Programación / .NET (C#, VB.NET, ASP) / Base de Datos SQL Local Duda ? SOLUCIONADO !!
|
en: 12 Abril 2013, 23:15 pm
|
Amigos aprendiendo sobre este tema encontre un codigo que lo que haces es crear una base de datos lo ejecute en el Pc y trabajo sin problemas, mi duda es posible visualizar la bd para verificar.. Solucionado mi problema es que yo estaba trabajando con un archivo de tipo base datos *.mdf y entonces la instruccion para trabajar esta mal, abajo lo señalo Function CrearBD LabelInfo.Text = "Creando la base de datos..." LabelInfo.Refresh() ' La conexión a usar, indicando la base master ' Aqui esta el error cambie esta declaracion de cnn por esta ' Dim cnn As New SqlConnection( _ "Server=(local)\SQLEXPRESS; " & _ "database=master; integrated security=yes") Private cnn As String = "Data Source =.\SQLExpress; Integrated Security =true; AttachDbFilename =|DataDirectory|\VideoDB.mdf; User Instance =true;" ' La orden T-SQL para crear la tabla Dim s As String = "CREATE DATABASE " & txtDB.Text Dim cmd As New SqlCommand(s, cnn) Try ' Abrimos la conexión y ejecutamos el comando cnn.Open() cmd.ExecuteNonQuery() ' LabelInfo.Text = "Base de datos creada correctamente" Catch ex As Exception LabelInfo.Text = "Error al crear la base de datos" MessageBox.Show(ex.Message, _ "Error al crear la base", _ MessageBoxButtons.OK, MessageBoxIcon.Error) Finally ' Por si se produce un error, ' comprobar si la conexión está abierta If cnn.State = ConnectionState.Open Then cnn.Close() End If End Try End Function
|
|
|
262
|
Programación / .NET (C#, VB.NET, ASP) / Que tal un hilo para resolver Ejercicios ??
|
en: 3 Abril 2013, 01:17 am
|
Pongo varios...
1. Escriba un programa que sea capaz de determinar el valor mayor de entre 5 números introducidos por el usuario. 2. Dado un número introducido desde el teclado, determinar si es primo o no. 3. Elaborar un programa que determine el número de caracteres de una línea de texto, introducida desde el teclado. 4. Escribir un programa que genere como resultado las tablas de multiplicar a partir de un número introducido por el usuario. 5. Escribir un programa que determine la factorial de un número introducido desde el teclado. 6. Escriba un programa que calcule el Máximo Común Divisor de dos números, considerando que el MCD de dos números o más es el U mayor número que los divide a todos exactamente. 7. Escribir un programa que simule un cronómetro digital. Ej: 00 : 01 : 35 . 45 (HH:MM:SS:MM) 8. Escribir un programa que solicite al usuario el día, mes y año de nacimiento y que genere como resultado el signo del zodíaco al cual pertenece, y los años, meses y días de vida con los que cuenta. 9. Diseñe un programa que sea capaz de simular el comportamiento de un cajero automático, desde solicitar el PIN de seguridad, realizar transacciones de retiros y que valide cuando hay o no fondos disponibles.
Salu2
|
|
|
264
|
Programación / .NET (C#, VB.NET, ASP) / Funciona desde el VS2010 pero la App compilada no !
|
en: 15 Marzo 2013, 20:45 pm
|
Amigos tengo una urgencia, la App que estoy trabajando corre sin problema alguno desde el VS2010 lo que hace es comunicarse por el SerialPort con un Celular mandando comandos AT y recibiendo respuestas. Ahora cuando ejecuto el .EXE no me da la respuesta del Cell nada mas me muestra el comando que envio con la respuesta inicial OK pero no me llegan los otros datos y les digo que desde el VS2010 si llegan que puede estar pasando les pongo el codigo. Imports System.Text Public Class MainForm ' Declare necessary class variables. Private CommPort As New RS232() Private IsModemFound As Boolean = False Private ModemPort As Integer = 0 ' This subroutine clears the TextBox. Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click Me.StatusTextbox.Clear() End Sub ' This subroutine sends a user specified command to the modem, and records its ' response. It depends on the timer to do the reading of the response. Private Sub SendUserCommandButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendUserCommandButton.Click ' Always wrap up working with Comm Ports in exception handlers. Try ' Enable the timer. 'If Not Me.tmrReadCommPort.Enabled Then Me.tmrReadCommPort.Enabled = True 'End If 'If Not CommPort.IsOpen Then ' Attempt to open the port. CommPort.Open(8, 115200, 8, RS232.DataParity.Parity_None, RS232.DataStopBit.StopBit_1, 4096) 'End If 'Write an user specified Command to the Port. CommPort.Write(Encoding.ASCII.GetBytes(Me.UserCommandTextbox.Text & Chr(13))) ' Sleep long enough for the modem to respond and the timer to fire. System.Threading.Thread.Sleep(200) Application.DoEvents() CommPort.Close() Catch ex As Exception ' Warn the user. MessageBox.Show("Unable to communicate with Modem") Finally ' Disable the timer. Me.tmrReadCommPort.Enabled = False End Try End Sub ' This subroutine is fired when the timer event is raised. It writes whatever ' is in the Comm Port buffer to the output window. Private Sub tmrReadCommPort_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrReadCommPort.Tick Try ' As long as there is information, read one byte at a time and ' output it. While (CommPort.Read(1) <> -1) ' Write the output to the screen. WriteMessage(Chr(CommPort.InputStream(0)), False) End While Catch exc As Exception ' An exception is raised when there is no information to read. ' Don't do anything here, just let the exception go. End Try End Sub ' This subroutine writes a message to the txtStatus TextBox. Private Sub WriteMessage(ByVal message As String) Me.StatusTextbox.Text += message + vbCrLf End Sub ' This subroutine writes a message to the txtStatus TextBox and allows ' the line feed to be suppressed. Private Sub WriteMessage(ByVal message As String, ByVal linefeed As Boolean) Me.StatusTextbox.Text += message If linefeed Then Me.StatusTextbox.Text += vbCrLf End If End Sub Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click CommPort.Close() End End Sub Private Sub MainForm_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing CommPort.Close() End Sub
|
|
|
267
|
Programación / .NET (C#, VB.NET, ASP) / DevExpress ?
|
en: 2 Marzo 2013, 17:21 pm
|
Amigos quisiera saber si alguien tiene documentacion o videos en español donde pueda adquirir una base sobre este excelente componente..
Por ejemplo como emplear los skins..
Se que hay videos ya los estoy bajando y viendo pero ese del uso del skin se me hace complicado...
Gracias.
|
|
|
269
|
Programación / .NET (C#, VB.NET, ASP) / Enviar un Form usando Httprequest !!
|
en: 12 Febrero 2013, 00:55 am
|
Amigos tengo un code con el que envio un FORM usando HTTPrequest con el metodo POST sin problemas, lo que sucede es que ese FORM tiene para mandar 3 fotos y ahi es donde se me traba el paraguas el CODE que tengo hasta ahora es este.. Imports System Imports System.IO Imports System.Net Imports System.Text Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim precio As String, categoria As String, titulo As String, cuerpo As String, _ filesize As String, email As String, phone As String 'Dim boundary As String = "---------------------------" + DateTime.Now.Ticks.ToString("x") ' Create the data we want to send precio = "25" categoria = "105" titulo = "titulo del form" cuerpo = "aki va el cuerpo del mensaje" email = "user@gnome.com" phone = "1234567" filesize = "307200" ' Create a request using a URL that can receive a post. Dim request As HttpWebRequest = HttpWebRequest.Create("URL") ' Set the Method property of the request to POST. request.Method = "POST" request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" Dim postdata As String = "ad_price=" & precio & "&category=" & categoria & "&ad_headline=" & _ titulo & "&ad_text=" & cuerpo & "&email=" & email & "&phone=" & phone & "&MAX_FILE_SIZE=" & filesize Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postdata) ' Set the ContentType property of the WebRequest. request.ContentType = "application/x-www-form-urlencoded" ' Set the ContentLength property of the WebRequest. request.ContentLength = byteArray.Length ' Get the request stream. Dim dataStream As Stream = request.GetRequestStream() ' Write the data to the request stream. dataStream.Write(byteArray, 0, byteArray.Length) ' Close the Stream object. dataStream.Close() ' Get the response. Dim response As WebResponse = request.GetResponse() ' Display the status. Console.WriteLine(CType(response, HttpWebResponse).StatusDescription) ' Get the stream containing content returned by the server. dataStream = response.GetResponseStream() ' Open the stream using a StreamReader for easy access. Dim reader As New StreamReader(dataStream) ' Read the content. Dim responseFromServer As String = reader.ReadToEnd() ' Display the content. txtoutput.Text = responseFromServer ' Clean up the streams. reader.Close() dataStream.Close() response.Close() End Sub End Class
Muchas gracias por cualquier ayuda
|
|
|
270
|
Programación / .NET (C#, VB.NET, ASP) / Necesito anclar mi APP ?
|
en: 3 Febrero 2013, 02:19 am
|
Hola pues eso ando buscando algun dato en el Pc que nunca varie aunque formateen el Pc y reinstalen tambien que no se pueda simular en otra Pc, para que mi app lo verifique siempre antes de iniciar y nada mas corra en al Pc que yo quiera...
Tambien si es posible diganme algun metodo seguro para cifrar mi App, conozco el programa Armadillo pero no se si es necesario llegar hasta alla...
Salu2
|
|
|
|
|
|
|