?
Solved

asp.net - sample API insert a row into a databasae...

Posted on 2011-03-08
4
Medium Priority
?
380 Views
Last Modified: 2012-05-11
does anyone have a sample API..that will allow a user to insert a row into MS SQL Server DB...in VB.NET...
0
Comment
Question by:GlobaLevel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
Anil Golamari earned 2000 total points
ID: 35073550
some thing similar to this.

<WebMethod()>
 Public Function samplemethod(ByVal searchvalue As String) As string

Dim connStr As String = "Your connection string"       
Dim cmdTxt As String = "Sql query"
Dim myConn As New System.Data.SqlClient.SqlConnection(connStr)
Dim myCmd As New System.Data.SqlClient.SqlCommand(cmdTxt, myConn)
    Try
        myConn.Open()       
        myCmd.ExecuteNonQuery()
      
           Catch ex As Exception
               ' handle exception
           End Try
      
           If myConn.State = Data.ConnectionState.Open
 Then myConn.Close()
            myConn.Dispose()
           myCmd.Dispose()
      
       End Function
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 35074032
good stuff...one quick question...after inserting the value into the db...the web service then retrieves a .mp3 file and returns it to the client and plays automatically thru a media player...is this possible?  thanks in advance...
0
 
LVL 18

Expert Comment

by:Anil Golamari
ID: 35074060
I just want to understand clearly, Here one you insert some data into sql server then your web service has to retrieve a .mp3 file and return it too client right?
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 35074168
I just want to understand clearly, Here one you insert some data into sql server then your web service has to retrieve a .mp3 file and return it too client right?

> correct....Im not sure if SQL Server can hold .mp3 files..or if the web server will have to pull it from a file directory off the server and return it to the client...thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month9 days, 20 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question